/** * testBehaviorMethodDispatching method * * @return void */ public function testBehaviorMethodDispatching() { $Apple = new Restaurant(); $Apple->Behaviors->load('Test'); $expected = 'working'; $this->assertEquals($expected, $Apple->testMethod()); $this->assertEquals($expected, $Apple->Behaviors->dispatchMethod($Apple, 'testMethod')); $result = $Apple->Behaviors->dispatchMethod($Apple, 'wtf'); $this->assertEquals(array('unhandled'), $result); $result = $Apple->{'look for the remote'}('in the couch'); $expected = "Item.name = 'the remote' AND Location.name = 'the couch'"; $this->assertEquals($expected, $result); $result = $Apple->{'look for THE REMOTE'}('in the couch'); $expected = "Item.name = 'THE REMOTE' AND Location.name = 'the couch'"; $this->assertEquals($expected, $result, 'Mapped method was lowercased.'); }