File contents:
<?php interface BaseInterface { } interface SubInterface1 extends BaseInterface { } interface SubInterface2 extends BaseInterface { } class SubClass1_0 implements BaseInterface { } class SubClass2_0 implements BaseInterface { } class SubClass1_1 implements SubInterface1 { } abstract class SubClass2_1 implements SubInterface1 { } class SubClass1_2 implements SubInterface2 { } class SubClass2_2 implements SubInterface2 { }
- create a PHP file with above content anywhere within module directory space
- run the php tools/build_class_map.php to rebuild class map
- press the Reset button under the Reset Parsed and Cached System Data section in System Tools section
- place $sub_classes = $this->Application->getSubClasses('SubInterface1'); somewhere
- confirm, that $sub_classes array contains following classes:
- SubClass1_1
- place $sub_classes = $this->Application->getSubClasses('SubInterface1', false); somewhere
- confirm, that $sub_classes array contains following classes:
- SubClass1_1
- SubClass2_1
- place $sub_classes = $this->Application->getSubClasses('BaseInterface'); somewhere
- confirm, that $sub_classes array contains following classes:
- SubClass1_0
- SubClass2_0
- SubClass1_1
- SubClass1_2
- SubClass2_2
- in test file change interfaces into classes
- repeat above testing scenario (interfaces transformed into classes will also be present in results and that's normal)
- use the getSubClasses method on a class/interface not under In-Portal (or non-existing class/interface) auto-loader control
- confirm, that this will result in exception
- register a replacement interface (via RegisterClasses unit config setting in any unit config) for SubInterface2 interface
- confirm that $sub_classes = $this->Application->getSubClasses('BaseInterface');:
- containers replaced interface
- doesn't contain SubInterface2 interface
- the sub-classes/sub-interfaces of replaced SubInterface2 are listed in array
- the sub-classes/sub-interfaces of replacement interface are not listed in array