Bug #20517 » 11206.diff
tests/t3lib/t3lib_extmgm_testcase.php (working copy) | ||
---|---|---|
* This copyright notice MUST APPEAR in all copies of the script!
|
||
***************************************************************/
|
||
/**
|
||
* Testcase for class t3lib_extMgm
|
||
*
|
||
* @author Oliver Hader <oliver@typo3.org>
|
||
* @author Oliver Hader <oliver@typo3.org>
|
||
* @author Oliver Klee <typo3-coding@oliverklee.de>
|
||
*
|
||
* @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();
|
||
... | ... | |
);
|
||
}
|
||
public function tearDown() {
|
||
foreach ($this->globals as $key => $value) {
|
||
$GLOBALS[$key] = unserialize($value);
|
||
}
|
||
}
|
||
/////////////////////////////////////////////
|
||
// Tests concerning getExtensionKeyByPrefix
|
||
/////////////////////////////////////////////
|
||
/**
|
||
* @test
|
||
* @see t3lib_extMgm::getExtensionKeyByPrefix
|
||
*
|
||
* @author Oliver Hader <oliver@typo3.org>
|
||
* @author Oliver Klee <typo3-coding@oliverklee.de>
|
||
*/
|
||
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 <oliver@typo3.org>
|
||
* @author Oliver Klee <typo3-coding@oliverklee.de>
|
||
*/
|
||
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 <oliver@typo3.org>
|
||
* @author Oliver Klee <typo3-coding@oliverklee.de>
|
||
*/
|
||
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);
|
||
}
|
||
}
|
||
}
|
||
?>
|