silverstripe-framework/tests/ClassInfoTest.php
Ingo Schommer d9b3abf8ac MINOR Documented ClassInfo::subclassesFor() and added unit tests
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.3@67689 467b73ca-7a2a-4603-9d3b-597d59a354a9
2011-02-02 14:26:47 +13:00

33 lines
687 B
PHP

<?php
/**
* @package sapphire
* @subpackage tests
*/
class ClassInfoTest extends SapphireTest {
function testSubclassesFor() {
$this->assertEquals(
ClassInfo::subclassesFor('ClassInfoTest_BaseClass'),
array(
0 => 'ClassInfoTest_BaseClass',
'ClassInfoTest_ChildClass' => 'ClassInfoTest_ChildClass',
'ClassInfoTest_GrandChildClass' => 'ClassInfoTest_GrandChildClass'
),
'ClassInfo::subclassesFor() returns only direct subclasses and doesnt include base class'
);
}
}
class ClassInfoTest_BaseClass {
}
class ClassInfoTest_ChildClass extends ClassInfoTest_BaseClass {
}
class ClassInfoTest_GrandChildClass extends ClassInfoTest_ChildClass {
}
?>