MINOR: Updated ClassInfo::allClasses() and ::exists() to use $_CLASS_MANIFEST rather than $_ALL_CLASSES. This means results from ClassInfo::allClasses() are now lowercase.

This commit is contained in:
ajshort 2011-02-27 15:20:28 +11:00
parent a0f66099ed
commit 852920237e
2 changed files with 11 additions and 5 deletions

View File

@ -12,16 +12,16 @@ class ClassInfo {
* @todo Improve documentation
*/
static function allClasses() {
global $_ALL_CLASSES;
return $_ALL_CLASSES['exists'];
global $_CLASS_MANIFEST;
return ArrayLib::valuekey(array_keys($_CLASS_MANIFEST));
}
/**
* @todo Improve documentation
*/
static function exists($class) {
global $_ALL_CLASSES;
return isset($_ALL_CLASSES['exists'][$class]) ? $_ALL_CLASSES['exists'][$class] : null;
global $_CLASS_MANIFEST;
return class_exists($class, false) || array_key_exists(strtolower($class), $_CLASS_MANIFEST);
}
/**

View File

@ -4,7 +4,13 @@
* @subpackage tests
*/
class ClassInfoTest extends SapphireTest {
public function testExists() {
$this->assertTrue(ClassInfo::exists('Object'));
$this->assertTrue(ClassInfo::exists('ClassInfoTest'));
$this->assertTrue(ClassInfo::exists('stdClass'));
}
function testSubclassesFor() {
$this->assertEquals(
ClassInfo::subclassesFor('ClassInfoTest_BaseClass'),