public function testGetCommonParentClass() { $map = array('stdClass' => array(array('stdClass', 'stdClass')), false => array(array('Exception', 'stdClass')), 'Exception' => array(array('Exception', 'RuntimeException'), array('LogicException', 'RuntimeException'), array('BadMethodCallException', 'OutOfBoundsException'))); foreach ($map as $expect => $tests) { if (is_int($expect)) { $expect = (bool) $expect; } foreach ($tests as $input) { list($class_a, $class_b) = $input; $this->assertEqual($expect, PhutilTypeSpec::getCommonParentClass($class_a, $class_b), print_r($input, true)); } } }