[TASK] Re-add unit tests for ExtensionCompatibilityTester 15/30915/3
authorSusanne Moog <typo3@susannemoog.de>
Fri, 20 Jun 2014 10:23:21 +0000 (12:23 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Fri, 20 Jun 2014 11:37:52 +0000 (13:37 +0200)
The tests for the ExtensionCompatibilityTester are currently skipped.
This patch removes the broken tests and leaves the working ones.

Releases: 6.3
Resolves: #59700

Change-Id: I10a49d0dddf2807bd50944837e31f0105374c8c9
Reviewed-on: https://review.typo3.org/30915
Reviewed-by: Anja Leichsenring
Tested-by: Anja Leichsenring
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
typo3/sysext/install/Tests/Unit/Controller/Action/Ajax/ExtensionCompatibilityTesterTest.php

index 3a710da..f94bac0 100644 (file)
@@ -31,9 +31,6 @@ use TYPO3\CMS\Core\Utility;
  */
 class ExtensionCompatibilityTesterTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
 
-       public function setUp() {
-               $this->markTestIncomplete('FIXME: rework to match package management change');
-       }
        /**
         * Tear down
         *
@@ -49,6 +46,21 @@ class ExtensionCompatibilityTesterTest extends \TYPO3\CMS\Core\Tests\UnitTestCas
        /**
         * @test
         */
+       public function getExtensionsToLoadGetsExtensionsWithoutExcluded() {
+               $GLOBALS['TYPO3_LOADED_EXT'] = array(
+                       'cms' => '',
+                       'news' => '',
+                       'info' => ''
+               );
+               $extensionCompatibilityTesterMock = $this->getAccessibleMock('TYPO3\\CMS\\Install\\Controller\\Action\\Ajax\\ExtensionCompatibilityTester', array('getExtensionsToExclude'), array());
+               $extensionCompatibilityTesterMock->expects($this->once())->method('getExtensionsToExclude')->will($this->returnValue(array('cms', 'info')));
+               $result = $extensionCompatibilityTesterMock->_call('getExtensionsToLoad');
+               $this->assertEquals(array('news' => ''), $result);
+       }
+
+       /**
+        * @test
+        */
        public function executeActionReturnsStringOkIfAllIsWell() {
                $extensionCompatibilityTesterMock = $this->getAccessibleMock('TYPO3\\CMS\\Install\\Controller\\Action\\Ajax\\ExtensionCompatibilityTester', array('getExtensionsToLoad', 'tryToLoadExtLocalconfAndExtTablesOfExtensions', 'deleteProtocolFile'), array());
                $extensionCompatibilityTesterMock->expects($this->once())->method('getExtensionsToLoad')->will($this->returnValue(array()));
@@ -98,31 +110,7 @@ class ExtensionCompatibilityTesterTest extends \TYPO3\CMS\Core\Tests\UnitTestCas
                $this->assertFalse(file_exists(PATH_site . 'typo3temp/ExtensionCompatibilityTester.txt'));
        }
 
-       /**
-        * @test
-        */
-       public function getLoadedExtensionsReturnsArray() {
-               $extensionCompatibilityTesterMock = $this->getAccessibleMock('TYPO3\\CMS\\Install\\Controller\\Action\\Ajax\\ExtensionCompatibilityTester', array('dummy'), array());
-               $result = $extensionCompatibilityTesterMock->_call('getExtensionsToLoad');
-               $this->assertInternalType('array', $result);
-       }
 
-       /**
-        * @test
-        */
-       public function loadExtTablesForExtensionIncludesExtTablesPhp() {
-               $extension = array(
-                       'demo1' => array(
-                               'type' => 'L',
-                               'ext_tables.php' => PATH_typo3 . 'sysext/install/Tests/Unit/Controller/Action/Ajax/Fixtures/demo1/ext_tables.php'
-                       )
-               );
-               $extensionCompatibilityTesterMock = $this->getAccessibleMock('TYPO3\\CMS\\Install\\Controller\\Action\\Ajax\\ExtensionCompatibilityTester', array('dummy'), array());
-               $extensionCompatibilityTesterMock->_call('loadExtTablesForExtension', 'demo1', $extension['demo1']);
-               $this->assertArrayHasKey('demo1_executed', $GLOBALS);
-               $this->assertEquals('foobar', $GLOBALS['demo1_executed']);
-               unset($GLOBALS['demo1_executed']);
-       }
 
        /**
         * @test
@@ -186,7 +174,6 @@ class ExtensionCompatibilityTesterTest extends \TYPO3\CMS\Core\Tests\UnitTestCas
                $extensionCompatibilityTesterMock->_call('tryToLoadExtLocalconfAndExtTablesOfExtensions', $extension);
        }
 
-
        /**
         * @test
         */
@@ -200,18 +187,6 @@ class ExtensionCompatibilityTesterTest extends \TYPO3\CMS\Core\Tests\UnitTestCas
        /**
         * @test
         */
-       public function getExtensionsToLoadCallsGetExtensionsToExclude() {
-               $extensionCompatibilityTesterMock = $this->getAccessibleMock('TYPO3\\CMS\\Install\\Controller\\Action\\Ajax\\ExtensionCompatibilityTester', array('getExtensionsToExclude'), array());
-               $extensionCompatibilityTesterMock
-                       ->expects($this->once())
-                       ->method('getExtensionsToExclude')
-                       ->will($this->returnValue(array()));
-               $extensionCompatibilityTesterMock->_call('getExtensionsToLoad');
-       }
-
-       /**
-        * @test
-        */
        public function getExtensionsToExcludeReturnsArray() {
                $extensionCompatibilityTesterMock = $this->getAccessibleMock('TYPO3\\CMS\\Install\\Controller\\Action\\Ajax\\ExtensionCompatibilityTester', array('dummy'), array());
                $returnValue = $extensionCompatibilityTesterMock->_call('getExtensionsToExclude');