[BUGFIX] EmConfUtility accesses non-arrays
[Packages/TYPO3.CMS.git] / typo3 / sysext / extensionmanager / Tests / Unit / Utility / EmConfUtilityTest.php
index 4b0d9dc..0f370b3 100644 (file)
@@ -88,5 +88,36 @@ class EmConfUtilityTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                $fixture = new \TYPO3\CMS\Extensionmanager\Utility\EmConfUtility();
                $this->assertEquals($expected, $fixture->fixEmConf($input));
        }
+
+       /**
+        * @test
+        */
+       public function dependencyToStringUnsetsDependencies() {
+               $config = array(
+                       'depends' => array(
+                               'php' => '5.0',
+                               'something' => 'foo',
+                               'anything' => 'bar'
+                       )
+               );
+               $expected = 'something,anything';
+
+               /** @var \TYPO3\CMS\Extensionmanager\Utility\EmConfUtility $fixture */
+               $fixture = $fixture = new \TYPO3\CMS\Extensionmanager\Utility\EmConfUtility();
+               $result = $fixture::dependencyToString($config);
+               $this->assertEquals($expected, $result);
+       }
+
+       /**
+        * @test
+        */
+       public function dependencyToStringDealsWithInvalidInput() {
+               $input = array(
+                       'depends' => 'hello world'
+               );
+               /** @var \TYPO3\CMS\Extensionmanager\Utility\EmConfUtility $fixture */
+               $fixture = $fixture = new \TYPO3\CMS\Extensionmanager\Utility\EmConfUtility();
+               $this->assertEquals('', $fixture::dependencyToString($input));
+       }
 }
 ?>
\ No newline at end of file