diff --git a/tests/Doctrine/Tests/ORM/Query/QueryTest.php b/tests/Doctrine/Tests/ORM/Query/QueryTest.php index 67039461394..b04621af004 100644 --- a/tests/Doctrine/Tests/ORM/Query/QueryTest.php +++ b/tests/Doctrine/Tests/ORM/Query/QueryTest.php @@ -514,11 +514,14 @@ 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(); + $cacheItemMock->method('expiresAfter')->willReturnSelf(); $cache ->expects(self::atLeastOnce()) ->method('getItem') - ->willReturn($this->createMock(CacheItemInterface::class)); + ->willReturn($cacheItemMock); $this->entityManager->getConfiguration()->setQueryCache($cache); $this->entityManager @@ -528,11 +531,14 @@ 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(); + $cacheItemMock->method('expiresAfter')->willReturnSelf(); $cache ->expects(self::atLeastOnce()) ->method('getItem') - ->willReturn($this->createMock(CacheItemInterface::class)); + ->willReturn($cacheItemMock); $this->entityManager ->createQuery('select u from ' . CmsUser::class . ' u')