From dcfdb2d0a9d5e2be363db091131718981bb7db2a Mon Sep 17 00:00:00 2001 From: odain Date: Fri, 26 Nov 2021 10:28:56 +0100 Subject: [PATCH] =?UTF-8?q?N=C2=B04125=20-=20add=20integration=20test=20ap?= =?UTF-8?q?art=20from=20ApcService=20mocking?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/core/dictApcuTest.php | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/test/core/dictApcuTest.php b/test/core/dictApcuTest.php index a1b3c21d9..cce8060f9 100644 --- a/test/core/dictApcuTest.php +++ b/test/core/dictApcuTest.php @@ -119,16 +119,30 @@ PHP; rmdir(APPROOT."env-$this->sEnvName"); } - public function testInitLangIfNeeded_NoApc(){ - $this->oApcService->expects($this->any()) - ->method('function_exists') - ->willReturn(false); + public function InitLangIfNeeded_NoApcProvider(){ + return [ + 'apcu mocked' => [ 'bApcuMocked' => true ], + 'integration test - apcu service like in production - install php-apcu before' => [ 'bApcuMocked' => false ], + ]; + } - $this->oApcService->expects($this->never()) - ->method('apc_fetch'); + /** + * @dataProvider InitLangIfNeeded_NoApcProvider + */ + public function testInitLangIfNeeded_NoApc($bApcuMocked){ + if ($bApcuMocked) { + $this->oApcService->expects($this->any()) + ->method('function_exists') + ->willReturn(false); - $this->oApcService->expects($this->never()) - ->method('apc_store'); + $this->oApcService->expects($this->never()) + ->method('apc_fetch'); + + $this->oApcService->expects($this->never()) + ->method('apc_store'); + } else { + Dict::SetApcService(null); + } //EN US default language $this->assertEquals('en1', Dict::S('label1'));