Skip to content

Commit aca515e

Browse files
committed
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.
1 parent e0de79e commit aca515e

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

tests/Doctrine/Tests/ORM/Query/QueryTest.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -514,11 +514,13 @@ public function testGetParameterColonNormalize(): void
514514

515515
public function testGetQueryCacheDriverWithDefaults(): void
516516
{
517-
$cache = $this->createMock(CacheItemPoolInterface::class);
517+
$cache = $this->createMock(CacheItemPoolInterface::class);
518+
$cacheItemMock = $this->createMock(CacheItemInterface::class);
519+
$cacheItemMock->method('set')->willReturnSelf();
518520
$cache
519521
->expects(self::atLeastOnce())
520522
->method('getItem')
521-
->willReturn($this->createMock(CacheItemInterface::class));
523+
->willReturn($cacheItemMock);
522524

523525
$this->entityManager->getConfiguration()->setQueryCache($cache);
524526
$this->entityManager
@@ -528,11 +530,13 @@ public function testGetQueryCacheDriverWithDefaults(): void
528530

529531
public function testGetQueryCacheDriverWithCacheExplicitlySet(): void
530532
{
531-
$cache = $this->createMock(CacheItemPoolInterface::class);
533+
$cache = $this->createMock(CacheItemPoolInterface::class);
534+
$cacheItemMock = $this->createMock(CacheItemInterface::class);
535+
$cacheItemMock->method('set')->willReturnSelf();
532536
$cache
533537
->expects(self::atLeastOnce())
534538
->method('getItem')
535-
->willReturn($this->createMock(CacheItemInterface::class));
539+
->willReturn($cacheItemMock);
536540

537541
$this->entityManager
538542
->createQuery('select u from ' . CmsUser::class . ' u')

0 commit comments

Comments
 (0)