From aca515e3a716fb6a2bae7c9feb4e51a6cf2a5795 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Sun, 8 Oct 2023 12:59:43 +0200 Subject: [PATCH] Configure mock so as to support psr/cache 1 psr/cache 1 does not use native return types, and phpdoc is not enough to obtain a mock that has typed methods. --- tests/Doctrine/Tests/ORM/Query/QueryTest.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/Doctrine/Tests/ORM/Query/QueryTest.php b/tests/Doctrine/Tests/ORM/Query/QueryTest.php index 67039461394..2c0e841ba09 100644 --- a/tests/Doctrine/Tests/ORM/Query/QueryTest.php +++ b/tests/Doctrine/Tests/ORM/Query/QueryTest.php @@ -514,11 +514,13 @@ public function testGetParameterColonNormalize(): void public function testGetQueryCacheDriverWithDefaults(): void { - $cache = $this->createMock(CacheItemPoolInterface::class); + $cache = $this->createMock(CacheItemPoolInterface::class); + $cacheItemMock = $this->createMock(CacheItemInterface::class); + $cacheItemMock->method('set')->willReturnSelf(); $cache ->expects(self::atLeastOnce()) ->method('getItem') - ->willReturn($this->createMock(CacheItemInterface::class)); + ->willReturn($cacheItemMock); $this->entityManager->getConfiguration()->setQueryCache($cache); $this->entityManager @@ -528,11 +530,13 @@ public function testGetQueryCacheDriverWithDefaults(): void public function testGetQueryCacheDriverWithCacheExplicitlySet(): void { - $cache = $this->createMock(CacheItemPoolInterface::class); + $cache = $this->createMock(CacheItemPoolInterface::class); + $cacheItemMock = $this->createMock(CacheItemInterface::class); + $cacheItemMock->method('set')->willReturnSelf(); $cache ->expects(self::atLeastOnce()) ->method('getItem') - ->willReturn($this->createMock(CacheItemInterface::class)); + ->willReturn($cacheItemMock); $this->entityManager ->createQuery('select u from ' . CmsUser::class . ' u')