private function allowInheritance($allow = true) { $parser = new Parser(); $test = $this->createTestClass(true); $parser->setAllowInherited($allow); // allow all access modifications - public, protected & private $parser->setMethodFilter(null); $parser->analyze($test); $class = $parser->getClass("DerivedClass"); $this->assertNotNull($class, "Could not find class"); $methods = $class->getMethods(); // if inheritance is not allowed, there should be no methods found if (!$allow) { $this->assertEquals(0, count($methods)); return; } if (count($methods) < 1) { $this->fail("Expected to get at least one method, none found."); } // DerivedClass has no methods of its own, therefore all of its methods // should be declared by its parent class *only* foreach ($methods as $method) { $reflectionObj = $method->getReflectionObject(); $this->assertNotEquals($reflectionObj->class, get_class($test)); } }