mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
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:
parent
a0f66099ed
commit
852920237e
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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'),
|
||||
|
Loading…
x
Reference in New Issue
Block a user