public function testHasmethodBehaviour() { $obj = new ObjectTest_ExtendTest(); $this->assertTrue($obj->hasMethod('extendableMethod'), "Extension method found in original spelling"); $this->assertTrue($obj->hasMethod('ExTendableMethod'), "Extension method found case-insensitive"); $objs = array(); $objs[] = new ObjectTest_T2(); $objs[] = new ObjectTest_T2(); $objs[] = new ObjectTest_T2(); // All these methods should exist and return true $trueMethods = array('testMethod', 'otherMethod', 'someMethod', 't1cMethod', 'normalMethod'); foreach ($objs as $i => $obj) { foreach ($trueMethods as $method) { $methodU = strtoupper($method); $methodL = strtoupper($method); $this->assertTrue($obj->hasMethod($method), "Test that obj#{$i} has method {$method} ({$obj->class})"); $this->assertTrue($obj->hasMethod($methodU), "Test that obj#{$i} has method {$methodU}"); $this->assertTrue($obj->hasMethod($methodL), "Test that obj#{$i} has method {$methodL}"); $this->assertTrue($obj->{$method}(), "Test that obj#{$i} can call method {$method}"); $this->assertTrue($obj->{$methodU}(), "Test that obj#{$i} can call method {$methodU}"); $this->assertTrue($obj->{$methodL}(), "Test that obj#{$i} can call method {$methodL}"); } $this->assertTrue($obj->hasMethod('Wrapping'), "Test that obj#{$i} has method Wrapping"); $this->assertTrue($obj->hasMethod('WRAPPING'), "Test that obj#{$i} has method WRAPPING"); $this->assertTrue($obj->hasMethod('wrapping'), "Test that obj#{$i} has method wrapping"); $this->assertEquals("Wrapping", $obj->Wrapping(), "Test that obj#{$i} can call method Wrapping"); $this->assertEquals("Wrapping", $obj->WRAPPING(), "Test that obj#{$i} can call method WRAPPIGN"); $this->assertEquals("Wrapping", $obj->wrapping(), "Test that obj#{$i} can call method wrapping"); } }