Feature #22211 » 13697.diff
tests/t3lib/fixtures/ext_emconf.php (revision 0) | ||
---|---|---|
<?php
|
||
$EM_CONF[$_EXTKEY] = array(
|
||
'title' => '',
|
||
'description' => 'This is a fixture extension configuration file used for unit tests.',
|
||
'category' => '',
|
||
'shy' => 1,
|
||
'dependencies' => '',
|
||
'conflicts' => '',
|
||
'priority' => '',
|
||
'loadOrder' => '',
|
||
'module' => '',
|
||
'state' => 'stable',
|
||
'internal' => 1,
|
||
'uploadfolder' => 0,
|
||
'createDirs' => '',
|
||
'modify_tables' => '',
|
||
'clearCacheOnLoad' => 0,
|
||
'lockType' => '',
|
||
'author' => '',
|
||
'author_email' => '',
|
||
'author_company' => '',
|
||
'CGLcompliance' => '',
|
||
'CGLcompliance_note' => '',
|
||
'version' => '1.2.3',
|
||
'_md5_values_when_last_written' => '',
|
||
'constraints' => array(
|
||
'depends' => array(
|
||
),
|
||
'conflicts' => array(
|
||
),
|
||
'suggests' => array(
|
||
),
|
||
),
|
||
'suggests' => array(
|
||
),
|
||
);
|
||
?>
|
tests/t3lib/t3lib_extmgm_testcase.php (working copy) | ||
---|---|---|
'newA, newB, fieldX', $GLOBALS['TCA'][$table]['palettes']['generatedFor-fieldA']['showitem']
|
||
);
|
||
}
|
||
/////////////////////////////////////////
|
||
// Tests concerning getExtensionVersion
|
||
/////////////////////////////////////////
|
||
/**
|
||
* @test
|
||
*/
|
||
public function getExtensionVersionForEmptyExtensionKeyThrowsException() {
|
||
$this->setExpectedException(
|
||
't3lib_exception', '$key must not be empty.'
|
||
);
|
||
t3lib_extMgm::getExtensionVersion('');
|
||
}
|
||
/**
|
||
* @test
|
||
*/
|
||
public function getExtensionVersionForNotLoadedExtensionThrowsException() {
|
||
t3lib_extMgm::clearExtensionKeyMap();
|
||
$uniqueSuffix = uniqid('test');
|
||
$extensionKey = 'unloadedextension' . $uniqueSuffix;
|
||
$this->setExpectedException(
|
||
't3lib_exception',
|
||
'The extension ' . $extensionKey . ' is not installed.'
|
||
);
|
||
t3lib_extMgm::getExtensionVersion($extensionKey);
|
||
}
|
||
/**
|
||
* @test
|
||
*/
|
||
public function getExtensionVersionForLoadedExtensionReturnsExtensionVersion() {
|
||
t3lib_extMgm::clearExtensionKeyMap();
|
||
$uniqueSuffix = uniqid('test');
|
||
$extensionKey = 'unloadedextension' . $uniqueSuffix;
|
||
$GLOBALS['TYPO3_LOADED_EXT'][$extensionKey] = array(
|
||
'siteRelPath' => 'typo3_src/tests/t3lib/fixtures/',
|
||
);
|
||
$this->assertEquals(
|
||
'1.2.3',
|
||
t3lib_extMgm::getExtensionVersion($extensionKey)
|
||
);
|
||
}
|
||
}
|
||
?>
|
t3lib/class.t3lib_extmgm.php (working copy) | ||
---|---|---|
self::$extensionKeyMap = NULL;
|
||
}
|
||
/**
|
||
* Retrieves the version of an installed extension.
|
||
*
|
||
* @param string $key the key of the extension to look up, must not be empty
|
||
*
|
||
* @return string the extension version as a string in the format "x.y.z"
|
||
*/
|
||
static public function getExtensionVersion($key) {
|
||
global $_EXTKEY;
|
||
if ($key === '') {
|
||
throw new t3lib_exception('$key must not be empty.');
|
||
}
|
||
if (!self::isLoaded($key)) {
|
||
throw new t3lib_exception(
|
||
'The extension ' . $key . ' is not installed.'
|
||
);
|
||
}
|
||
$_EXTKEY = $key;
|
||
include(t3lib_extMgm::extPath($key) . 'ext_emconf.php');
|
||
return $EM_CONF[$key]['version'];
|
||
}
|
||