Skip to content

Commit 6a713dd

Browse files
authored
Remove calls to withConsecutive() (#10501)
1 parent 5f169d9 commit 6a713dd

File tree

2 files changed

+18
-16
lines changed

2 files changed

+18
-16
lines changed

tests/Doctrine/Tests/ORM/Mapping/ClassMetadataFactoryTest.php

+4-10
Original file line numberDiff line numberDiff line change
@@ -181,16 +181,10 @@ public function testIsTransient(): void
181181
$driver = $this->createMock(MappingDriver::class);
182182
$driver->expects(self::exactly(2))
183183
->method('isTransient')
184-
->withConsecutive(
185-
[CmsUser::class],
186-
[CmsArticle::class]
187-
)
188-
->willReturnMap(
189-
[
190-
[CmsUser::class, true],
191-
[CmsArticle::class, false],
192-
]
193-
);
184+
->willReturnMap([
185+
[CmsUser::class, true],
186+
[CmsArticle::class, false],
187+
]);
194188

195189
$em = $this->createEntityManager($driver);
196190

tests/Doctrine/Tests/ORM/Tools/Pagination/PaginatorTest.php

+14-6
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
use Doctrine\DBAL\Connection;
88
use Doctrine\DBAL\Driver;
9+
use Doctrine\DBAL\Result;
910
use Doctrine\ORM\Decorator\EntityManagerDecorator;
1011
use Doctrine\ORM\EntityManagerInterface;
1112
use Doctrine\ORM\Internal\Hydration\AbstractHydrator;
@@ -64,17 +65,24 @@ public function testExtraParametersAreStrippedWhenWalkerRemovingOriginalSelectEl
6465
$query->setMaxResults(1);
6566
$paginator = (new Paginator($query, true))->setUseOutputWalkers(false);
6667

68+
$receivedParams = [];
69+
$resultMock = $this->createMock(Result::class);
6770
$this->connection
68-
->expects(self::exactly(3))
6971
->method('executeQuery')
70-
->withConsecutive(
71-
[self::anything(), [$paramInWhere]],
72-
[self::anything(), [$paramInWhere]],
73-
[self::anything(), [$paramInSubSelect, $paramInWhere, $returnedIds]]
74-
);
72+
->willReturnCallback(static function (string $sql, array $params) use (&$receivedParams, $resultMock): Result {
73+
$receivedParams[] = $params;
74+
75+
return $resultMock;
76+
});
7577

7678
$paginator->count();
7779
$paginator->getIterator();
80+
81+
self::assertSame([
82+
[$paramInWhere],
83+
[$paramInWhere],
84+
[$paramInSubSelect, $paramInWhere, $returnedIds],
85+
], $receivedParams);
7886
}
7987

8088
public function testPaginatorNotCaringAboutExtraParametersWithoutOutputWalkers(): void

0 commit comments

Comments
 (0)