From 87333526e5297a9a65a916675eb612c9a60caf92 Mon Sep 17 00:00:00 2001 From: wickedOne Date: Sat, 7 Oct 2023 06:46:53 +0200 Subject: [PATCH] fix cache set return type in tests --- tests/PhraseProviderTest.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tests/PhraseProviderTest.php b/tests/PhraseProviderTest.php index 52a2b13..f4ec5b6 100644 --- a/tests/PhraseProviderTest.php +++ b/tests/PhraseProviderTest.php @@ -312,7 +312,10 @@ public function testReadFallbackLocale(): void */ public function testCacheKeyOptionsSort(array $options, string $expectedKey): void { - $this->getCache()->expects(self::once())->method('getItem')->with($expectedKey); + $item = $this->createMock(CacheItemInterface::class); + $item->method('set')->willReturnSelf(); + + $this->getCache()->expects(self::once())->method('getItem')->with($expectedKey)->willReturn($item); $this->getReadConfig()->method('getOptions')->willReturn($options); $this->getReadConfig()->expects(self::once()) @@ -519,6 +522,10 @@ public function testInitLocalesExceptions(int $statusCode, string $expectedExcep public function testInitLocalesPaginated(): void { + $item = $this->createMock(CacheItemInterface::class); + $item->method('set')->willReturnSelf(); + $this->getCache()->method('getItem')->willReturn($item); + $this->readConfigWithDefaultValues('messages'); $this->getLoader()->method('load')->willReturn(new MessageCatalogue('en')); @@ -576,6 +583,10 @@ public function testInitLocalesPaginated(): void public function testCreateUnknownLocale(): void { + $item = $this->createMock(CacheItemInterface::class); + $item->method('set')->willReturnSelf(); + $this->getCache()->method('getItem')->willReturn($item); + $this->readConfigWithDefaultValues('messages'); $this->getLoader()->method('load')->willReturn(new MessageCatalogue('en'));