OrnoTest\Route\DispatcherTest::testClassBasedControllerInvokesCorrectMethod PHP Метод

testClassBasedControllerInvokesCorrectMethod() публичный Метод

Asserts that the correct method is invoked on a class based controller
public testClassBasedControllerInvokesCorrectMethod ( ) : void
Результат void
    public function testClassBasedControllerInvokesCorrectMethod()
    {
        $controller = $this->getMock('SomeClass', ['someMethod']);
        $controller->expects($this->once())->method('someMethod')->with($this->equalTo('2'), $this->equalTo('phil'))->will($this->returnValue('hello world'));
        $container = $this->getMock('Orno\\Di\\Container');
        $container->expects($this->once())->method('get')->with($this->equalTo('SomeClass'))->will($this->returnValue($controller));
        $collection = new Route\RouteCollection($container);
        $collection->setStrategy(Route\RouteStrategyInterface::URI_STRATEGY);
        $collection->get('/route/{id}/{name}', 'SomeClass::someMethod');
        $dispatcher = $collection->getDispatcher();
        $response = $dispatcher->dispatch('GET', '/route/2/phil');
        $this->assertEquals('hello world', $response->getContent());
    }