mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
33 lines
687 B
PHP
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 {
|
||
|
|
||
|
}
|
||
|
?>
|