[BUGFIX] Fix apc/apcu cache backend tests 21/57621/4
authorChristian Kuhn <lolli@schwarzbu.ch>
Tue, 17 Jul 2018 20:52:52 +0000 (22:52 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Tue, 17 Jul 2018 21:49:03 +0000 (23:49 +0200)
bamboo php 7.2 has apc & apcu support again. Two
unit tests fail. These two however don't make much
sense in the first place since they md5(internal-knowledge).
Remove them.

Resolves: #85584
Releases: master
Change-Id: I5f1e1589189866508e684a7ca1bb6cae87d22fad
Reviewed-on: https://review.typo3.org/57621
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/core/Tests/Unit/Cache/Backend/ApcBackendTest.php
typo3/sysext/core/Tests/Unit/Cache/Backend/ApcuBackendTest.php

index 1dc2122..e13736e 100644 (file)
@@ -15,6 +15,7 @@ namespace TYPO3\CMS\Core\Tests\Unit\Cache\Backend;
  */
 
 use TYPO3\CMS\Core\Cache\Backend\ApcBackend;
+use TYPO3\CMS\Core\Cache\Frontend\FrontendInterface;
 
 /**
  * Testcase for the APC cache backend.
@@ -138,36 +139,6 @@ class ApcBackendTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
     /**
      * @test
      */
-    public function setCacheIsSettingIdentifierPrefixWithCacheIdentifier()
-    {
-        /** @var \PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface $cacheMock */
-        $cacheMock = $this->createMock(\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface::class);
-        $cacheMock->expects($this->any())->method('getIdentifier')->will($this->returnValue(
-            'testidentifier'
-        ));
-
-        /** @var $backendMock \PHPUnit_Framework_MockObject_MockObject|ApcBackend */
-        $backendMock = $this->getMockBuilder(ApcBackend::class)
-            ->setMethods(['setIdentifierPrefix', 'getCurrentUserData', 'getPathSite'])
-            ->setConstructorArgs(['testcontext'])
-            ->getMock();
-
-        $backendMock->expects($this->once())->method('getCurrentUserData')->will(
-            $this->returnValue(['name' => 'testname'])
-        );
-
-        $backendMock->expects($this->once())->method('getPathSite')->will(
-            $this->returnValue('testpath')
-        );
-
-        $expectedIdentifier = 'TYPO3_' . \TYPO3\CMS\Core\Utility\GeneralUtility::shortMD5('testpath' . 'testname' . 'testcontext' . 'testidentifier', 12);
-        $backendMock->expects($this->once())->method('setIdentifierPrefix')->with($expectedIdentifier);
-        $backendMock->setCache($cacheMock);
-    }
-
-    /**
-     * @test
-     */
     public function hasReturnsFalseIfTheEntryDoesNotExist()
     {
         $backend = $this->setUpBackend();
@@ -240,14 +211,14 @@ class ApcBackendTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
      */
     public function flushRemovesOnlyOwnEntries()
     {
-        /** @var \PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface $thisCache */
-        $thisCache = $this->createMock(\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface::class);
+        /** @var \PHPUnit_Framework_MockObject_MockObject|FrontendInterface $thisCache */
+        $thisCache = $this->createMock(FrontendInterface::class);
         $thisCache->expects($this->any())->method('getIdentifier')->will($this->returnValue('thisCache'));
         $thisBackend = new ApcBackend('Testing');
         $thisBackend->setCache($thisCache);
 
-        /** @var \PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface $thatCache */
-        $thatCache = $this->createMock(\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface::class);
+        /** @var \PHPUnit_Framework_MockObject_MockObject|FrontendInterface $thatCache */
+        $thatCache = $this->createMock(FrontendInterface::class);
         $thatCache->expects($this->any())->method('getIdentifier')->will($this->returnValue('thatCache'));
         $thatBackend = new ApcBackend('Testing');
         $thatBackend->setCache($thatCache);
@@ -303,8 +274,8 @@ class ApcBackendTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
      */
     protected function setUpBackend($accessible = false)
     {
-        /** @var \PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface $cache */
-        $cache = $this->createMock(\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface::class);
+        /** @var \PHPUnit_Framework_MockObject_MockObject|FrontendInterface $cache */
+        $cache = $this->createMock(FrontendInterface::class);
         if ($accessible) {
             $accessibleClassName = $this->buildAccessibleProxy(ApcBackend::class);
             $backend = new $accessibleClassName('Testing');
index bf9b55b..6a7610b 100644 (file)
@@ -17,7 +17,6 @@ namespace TYPO3\CMS\Core\Tests\Unit\Cache\Backend;
 use TYPO3\CMS\Core\Cache\Backend\ApcuBackend;
 use TYPO3\CMS\Core\Cache\Exception;
 use TYPO3\CMS\Core\Cache\Frontend\FrontendInterface;
-use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\TestingFramework\Core\AccessibleObjectInterface;
 
 /**
@@ -140,36 +139,6 @@ class ApcuBackendTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
     /**
      * @test
      */
-    public function setCacheIsSettingIdentifierPrefixWithCacheIdentifier()
-    {
-        /** @var \PHPUnit_Framework_MockObject_MockObject|FrontendInterface $cacheMock */
-        $cacheMock = $this->createMock(FrontendInterface::class);
-        $cacheMock->expects($this->any())->method('getIdentifier')->will($this->returnValue(
-            'testidentifier'
-        ));
-
-        /** @var $backendMock \PHPUnit_Framework_MockObject_MockObject|ApcuBackend */
-        $backendMock = $this->getMockBuilder(ApcuBackend::class)
-            ->setMethods(['setIdentifierPrefix', 'getCurrentUserData', 'getPathSite'])
-            ->setConstructorArgs(['testcontext'])
-            ->getMock();
-
-        $backendMock->expects($this->once())->method('getCurrentUserData')->will(
-            $this->returnValue(['name' => 'testname'])
-        );
-
-        $backendMock->expects($this->once())->method('getPathSite')->will(
-            $this->returnValue('testpath')
-        );
-
-        $expectedIdentifier = 'TYPO3_' . GeneralUtility::shortMD5('testpath' . 'testname' . 'testcontext' . 'testidentifier', 12);
-        $backendMock->expects($this->once())->method('setIdentifierPrefix')->with($expectedIdentifier);
-        $backendMock->setCache($cacheMock);
-    }
-
-    /**
-     * @test
-     */
     public function hasReturnsFalseIfTheEntryDoesNotExist()
     {
         $backend = $this->setUpBackend();