Index: tests/t3lib/t3lib_extmgm_testcase.php =================================================================== --- tests/t3lib/t3lib_extmgm_testcase.php (revision 5727) +++ tests/t3lib/t3lib_extmgm_testcase.php (working copy) @@ -22,18 +22,18 @@ * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ - /** * Testcase for class t3lib_extMgm * - * @author Oliver Hader + * @author Oliver Hader + * @author Oliver Klee + * * @package TYPO3 * @subpackage t3lib */ class t3lib_extmgm_testcase extends tx_phpunit_testcase { /** - * Contains backup of defined GLOBALS - * @var array + * @var array backup of defined GLOBALS */ protected $globals = array(); @@ -43,33 +43,64 @@ ); } + public function tearDown() { + foreach ($this->globals as $key => $value) { + $GLOBALS[$key] = unserialize($value); + } + } + + + ///////////////////////////////////////////// + // Tests concerning getExtensionKeyByPrefix + ///////////////////////////////////////////// + /** * @test * @see t3lib_extMgm::getExtensionKeyByPrefix + * + * @author Oliver Hader + * @author Oliver Klee */ - public function checkGetExtensionKeyByPrefix() { + public function getExtensionKeyByPrefixForLoadedExtensionWithUnderscoresReturnsTrue() { $uniqueSuffix = uniqid('test'); $GLOBALS['TYPO3_LOADED_EXT']['tt_news' . $uniqueSuffix] = array(); - $GLOBALS['TYPO3_LOADED_EXT']['kickstarter' . $uniqueSuffix] = array(); $this->assertEquals( 'tt_news' . $uniqueSuffix, t3lib_extMgm::getExtensionKeyByPrefix('tx_ttnews' . $uniqueSuffix) ); + } + + /** + * @test + * @see t3lib_extMgm::getExtensionKeyByPrefix + * + * @author Oliver Hader + * @author Oliver Klee + */ + public function getExtensionKeyByPrefixForLoadedExtensionWithoutUnderscoresReturnsTrue() { + $uniqueSuffix = uniqid('test'); + $GLOBALS['TYPO3_LOADED_EXT']['kickstarter' . $uniqueSuffix] = array(); + $this->assertEquals( 'kickstarter' . $uniqueSuffix, t3lib_extMgm::getExtensionKeyByPrefix('tx_kickstarter' . $uniqueSuffix) ); + } + + /** + * @test + * @see t3lib_extMgm::getExtensionKeyByPrefix + * + * @author Oliver Hader + * @author Oliver Klee + */ + public function getExtensionKeyByPrefixForNotLoadedExtensionReturnsFalse() { + $uniqueSuffix = uniqid('test'); + $this->assertFalse( t3lib_extMgm::getExtensionKeyByPrefix('tx_unloadedextension' . $uniqueSuffix) ); } - - public function tearDown() { - foreach ($this->globals as $key => $value) { - $GLOBALS[$key] = unserialize($value); - } - } } - ?> \ No newline at end of file