Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove calls to withConsecutive() #10501

Merged
merged 1 commit into from
Feb 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 4 additions & 10 deletions tests/Doctrine/Tests/ORM/Mapping/ClassMetadataFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
20 changes: 14 additions & 6 deletions tests/Doctrine/Tests/ORM/Tools/Pagination/PaginatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down