2009-02-02 00:49:53 +01:00
|
|
|
<?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'
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2009-07-01 00:08:59 +02:00
|
|
|
function testClassesForFolder() {
|
|
|
|
//$baseFolder = Director::baseFolder() . '/' . SAPPHIRE_DIR . '/tests/_ClassInfoTest';
|
|
|
|
//$manifestInfo = ManifestBuilder::get_manifest_info($baseFolder);
|
|
|
|
|
|
|
|
$classes = ClassInfo::classes_for_folder('sapphire/tests');
|
|
|
|
$this->assertContains(
|
2010-10-12 23:42:25 +02:00
|
|
|
'classinfotest',
|
2009-07-01 00:08:59 +02:00
|
|
|
$classes,
|
|
|
|
'ClassInfo::classes_for_folder() returns classes matching the filename'
|
|
|
|
);
|
|
|
|
// $this->assertContains(
|
|
|
|
// 'ClassInfoTest_BaseClass',
|
|
|
|
// $classes,
|
|
|
|
// 'ClassInfo::classes_for_folder() returns additional classes not matching the filename'
|
|
|
|
// );
|
|
|
|
}
|
|
|
|
|
2009-02-02 00:49:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
class ClassInfoTest_BaseClass {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
class ClassInfoTest_ChildClass extends ClassInfoTest_BaseClass {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
class ClassInfoTest_GrandChildClass extends ClassInfoTest_ChildClass {
|
|
|
|
|
|
|
|
}
|
|
|
|
?>
|