From 23053eef10f582d0931bf95197b1e3cae7d2e7df Mon Sep 17 00:00:00 2001 From: "Alexander M. Turek" Date: Mon, 6 Feb 2023 23:07:56 +0100 Subject: [PATCH] Remove calls to withConsecutive() --- .../ORM/Mapping/ClassMetadataFactoryTest.php | 14 ++++--------- .../ORM/Tools/Pagination/PaginatorTest.php | 20 +++++++++++++------ 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataFactoryTest.php b/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataFactoryTest.php index 36f3930fb2f..6b474750a0d 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataFactoryTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataFactoryTest.php @@ -181,16 +181,10 @@ public function testIsTransient(): void $driver = $this->createMock(MappingDriver::class); $driver->expects(self::exactly(2)) ->method('isTransient') - ->withConsecutive( - [CmsUser::class], - [CmsArticle::class] - ) - ->willReturnMap( - [ - [CmsUser::class, true], - [CmsArticle::class, false], - ] - ); + ->willReturnMap([ + [CmsUser::class, true], + [CmsArticle::class, false], + ]); $em = $this->createEntityManager($driver); diff --git a/tests/Doctrine/Tests/ORM/Tools/Pagination/PaginatorTest.php b/tests/Doctrine/Tests/ORM/Tools/Pagination/PaginatorTest.php index a1bad8847dd..1c8b47ac0cf 100644 --- a/tests/Doctrine/Tests/ORM/Tools/Pagination/PaginatorTest.php +++ b/tests/Doctrine/Tests/ORM/Tools/Pagination/PaginatorTest.php @@ -6,6 +6,7 @@ use Doctrine\DBAL\Connection; use Doctrine\DBAL\Driver; +use Doctrine\DBAL\Result; use Doctrine\ORM\Decorator\EntityManagerDecorator; use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\Internal\Hydration\AbstractHydrator; @@ -64,17 +65,24 @@ public function testExtraParametersAreStrippedWhenWalkerRemovingOriginalSelectEl $query->setMaxResults(1); $paginator = (new Paginator($query, true))->setUseOutputWalkers(false); + $receivedParams = []; + $resultMock = $this->createMock(Result::class); $this->connection - ->expects(self::exactly(3)) ->method('executeQuery') - ->withConsecutive( - [self::anything(), [$paramInWhere]], - [self::anything(), [$paramInWhere]], - [self::anything(), [$paramInSubSelect, $paramInWhere, $returnedIds]] - ); + ->willReturnCallback(static function (string $sql, array $params) use (&$receivedParams, $resultMock): Result { + $receivedParams[] = $params; + + return $resultMock; + }); $paginator->count(); $paginator->getIterator(); + + self::assertSame([ + [$paramInWhere], + [$paramInWhere], + [$paramInSubSelect, $paramInWhere, $returnedIds], + ], $receivedParams); } public function testPaginatorNotCaringAboutExtraParametersWithoutOutputWalkers(): void