/** * Raw form of is() method. You can use this to test for attributes * not supplied with the library by passing in $attribute conforming to * AttributeInterface. If it's something you think is important , consider * contributing it to the library. * * @extendAncestor * * @param string|AttributeInterface $attribute * * @return boolean * * @throws NotAnAttributeInterfaceException * @throws \BadMethodCallException */ public function test($attribute) { if (is_string($attribute)) { $attribute = ucfirst(strtolower($attribute)); $class = self::NS_NUMERIC_ATTRIBUTE . $attribute; if (class_exists($class)) { $obj = new $class(); } else { //let parent try to find the class return parent::test($attribute); } } else { $obj = $attribute; } //pass object to parent for testing return parent::test($obj); }
/** * @expectedException BadMethodCallException */ public function testTestMethodThrowsExceptionIfParamAsClassCannotBeFound() { $mA = new Matrix(array()); $mA->test('foobar'); }