[BUGFIX] Fix incomplete mocking in ExtensionManagementUtilityTest 21/29221/4
authorHelmut Hummel <helmut.hummel@typo3.org>
Sun, 6 Apr 2014 20:48:03 +0000 (22:48 +0200)
committerHelmut Hummel <helmut.hummel@typo3.org>
Sun, 6 Apr 2014 21:21:04 +0000 (23:21 +0200)
Some tests rely on actual extensions TCA being present.
Mock the method that reads the TCA files.

Resolves: #57700
Related: #57487
Releases: 6.2
Change-Id: I66cce578983fafc1bfe5a29cc0387b2e3d749873
Reviewed-on: https://review.typo3.org/29221
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
Reviewed-by: Helmut Hummel
Tested-by: Helmut Hummel
typo3/sysext/core/Classes/Utility/ExtensionManagementUtility.php
typo3/sysext/core/Tests/Unit/Utility/ExtensionManagementUtilityTest.php

index cfde262..d88cade 100644 (file)
@@ -1576,16 +1576,16 @@ tt_content.' . $key . $prefix . ' {
                if ($allowCaching) {
                        $cacheIdentifier = static::getBaseTcaCacheIdentifier();
                        /** @var $codeCache \TYPO3\CMS\Core\Cache\Frontend\PhpFrontend */
-                       $codeCache = self::getCacheManager()->getCache('cache_core');
+                       $codeCache = static::getCacheManager()->getCache('cache_core');
                        if ($codeCache->has($cacheIdentifier)) {
                                // substr is necessary, because the php frontend wraps php code around the cache value
                                $GLOBALS['TCA'] = unserialize(substr($codeCache->get($cacheIdentifier), 6, -2));
                        } else {
-                               self::buildBaseTcaFromSingleFiles();
-                               self::createBaseTcaCacheFile();
+                               static::buildBaseTcaFromSingleFiles();
+                               static::createBaseTcaCacheFile();
                        }
                } else {
-                       self::buildBaseTcaFromSingleFiles();
+                       static::buildBaseTcaFromSingleFiles();
                }
        }
 
index 260560e..368425e 100644 (file)
@@ -121,6 +121,8 @@ class ExtensionManagementUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
                                '  public static function getExtTablesCacheIdentifier() {' .
                                '    return parent::getExtTablesCacheIdentifier();' .
                                '  }' .
+                               '  public static function buildBaseTcaFromSingleFiles() {' .
+                               '  }' .
                                '}'
                        );
                }
@@ -949,7 +951,7 @@ class ExtensionManagementUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
                $mockCacheManager = $this->getMock('TYPO3\\CMS\\Core\\Cache\\CacheManager', array('getCache'));
                $mockCacheManager->expects($this->never())->method('getCache');
                ExtensionManagementUtilityAccessibleProxy::setCacheManager($mockCacheManager);
-               ExtensionManagementUtility::loadBaseTca(FALSE);
+               ExtensionManagementUtilityAccessibleProxy::loadBaseTca(FALSE);
        }
 
        /**
@@ -968,7 +970,7 @@ class ExtensionManagementUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
                ExtensionManagementUtilityAccessibleProxy::setCacheManager($mockCacheManager);
                $mockCache->expects($this->any())->method('has')->will($this->returnValue(TRUE));
                $mockCache->expects($this->once())->method('get');
-               ExtensionManagementUtility::loadBaseTca(TRUE);
+               ExtensionManagementUtilityAccessibleProxy::loadBaseTca(TRUE);
        }
 
        /**
@@ -1018,7 +1020,7 @@ class ExtensionManagementUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
                ExtensionManagementUtilityAccessibleProxy::setCacheManager($mockCacheManager);
                $mockCache->expects($this->once())->method('has')->will($this->returnValue(FALSE));
                $mockCache->expects($this->once())->method('set')->with($this->anything(), $this->anything(), $this->equalTo(array()));
-               ExtensionManagementUtility::loadBaseTca();
+               ExtensionManagementUtilityAccessibleProxy::loadBaseTca();
        }
 
        /////////////////////////////////////////