protected function setUp() { $this->object = new ComponentArgument('my_component_key'); $this->against = new WeakPunch(); $this->container = $this->getMock('IDependencyInjectionContainer'); $this->container->expects($this->any())->method('getInstanceOf')->will($this->returnValue($this->against)); }
public function testForward() { $route = $this->getMock('IRoute'); $route->expects($this->once())->method('setPackage')->will($this->returnValue($route)); $route->expects($this->once())->method('setController')->will($this->returnValue($route)); $route->expects($this->once())->method('setAction')->will($this->returnValue($route)); $route->expects($this->once())->method('setParameters')->will($this->returnValue($route)); $request = $this->getMock('IRequest'); $runner = $this->getMock('IControllerRunner'); $runner->expects($this->once())->method('run')->with($this->equalTo($route))->will($this->returnValue('ok')); $this->container->expects($this->exactly(3))->method('getInstanceOf')->will($this->onConsecutiveCalls($route, $request, $runner)); $this->assertThat($this->object->forward('package', 'controller', 'action', array('params')), $this->equalTo('ok')); }