[BUGFIX] Make category TCA changes cacheable
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Tests / Unit / Utility / ExtensionManagementUtilityTest.php
index 08b9d38..fc6e3bb 100644 (file)
@@ -1337,24 +1337,23 @@ class ExtensionManagementUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
        /**
         * @test
         */
-       public function isMakeCategorizableAvailableInRegistryWithDefaultField() {
+       public function doesMakeCategorizableCallsTheCategoryRegistryWithDefaultFieldName() {
                $extensionKey = uniqid('extension');
                $tableName = uniqid('table');
                $GLOBALS['TCA'][$tableName] = array(
                        'ctrl' => array(),
                        'columns' => array()
                );
-               $registryMock = $this->getMock('TYPO3\\CMS\\Core\\Category\\CategoryRegistry', array('dummy'));
+               $registryMock = $this->getMock('TYPO3\\CMS\\Core\\Category\\CategoryRegistry');
+               $registryMock->expects($this->once())->method('add')->with($extensionKey, $tableName, 'categories', array());
                \TYPO3\CMS\Core\Utility\GeneralUtility::setSingletonInstance('TYPO3\\CMS\\Core\\Category\\CategoryRegistry', $registryMock);
                ExtensionManagementUtility::makeCategorizable($extensionKey, $tableName);
-               $registryMock->applyTca();
-               $this->assertNotEmpty($GLOBALS['TCA'][$tableName]['columns']['categories']);
        }
 
        /**
         * @test
         */
-       public function isMakeCategorizableAvailableInRegistryWithSpecifictField() {
+       public function doesMakeCategorizableCallsTheCategoryRegistryWithFieldName() {
                $extensionKey = uniqid('extension');
                $tableName = uniqid('table');
                $fieldName = uniqid('field');
@@ -1362,11 +1361,10 @@ class ExtensionManagementUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
                        'ctrl' => array(),
                        'columns' => array()
                );
-               $registryMock = $this->getMock('TYPO3\\CMS\\Core\\Category\\CategoryRegistry', array('dummy'));
+               $registryMock = $this->getMock('TYPO3\\CMS\\Core\\Category\\CategoryRegistry');
+               $registryMock->expects($this->once())->method('add')->with($extensionKey, $tableName, $fieldName, array());
                \TYPO3\CMS\Core\Utility\GeneralUtility::setSingletonInstance('TYPO3\\CMS\\Core\\Category\\CategoryRegistry', $registryMock);
                ExtensionManagementUtility::makeCategorizable($extensionKey, $tableName, $fieldName);
-               $registryMock->applyTca();
-               $this->assertNotEmpty($GLOBALS['TCA'][$tableName]['columns'][$fieldName]);
        }
 
 }