From 852920237e8d7c89cb2ac66ffe4dbe6220b71831 Mon Sep 17 00:00:00 2001 From: ajshort Date: Sun, 27 Feb 2011 15:20:28 +1100 Subject: [PATCH] MINOR: Updated ClassInfo::allClasses() and ::exists() to use $_CLASS_MANIFEST rather than $_ALL_CLASSES. This means results from ClassInfo::allClasses() are now lowercase. --- core/ClassInfo.php | 8 ++++---- tests/ClassInfoTest.php | 8 +++++++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/core/ClassInfo.php b/core/ClassInfo.php index e1e3d5a18..503df0bab 100644 --- a/core/ClassInfo.php +++ b/core/ClassInfo.php @@ -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); } /** diff --git a/tests/ClassInfoTest.php b/tests/ClassInfoTest.php index bc3c49daa..53d261ef4 100644 --- a/tests/ClassInfoTest.php +++ b/tests/ClassInfoTest.php @@ -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'),