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

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

Asserts that the correct method is invoked on a class based controller
    public function testClassBasedControllerInvokesCorrectMethodOnMethodArgumentStrategy()
    {
        $controller = $this->getMock('SomeClass', ['someMethod']);
        $container = $this->getMock('Orno\\Di\\Container');
        $container->expects($this->once())->method('get')->with($this->equalTo('SomeClass'))->will($this->returnValue($controller));
        $container->expects($this->once())->method('call')->with($this->equalTo([$controller, 'someMethod']))->will($this->returnValue('hello world'));
        $collection = new Route\RouteCollection($container);
        $collection->setStrategy(Route\RouteStrategyInterface::METHOD_ARGUMENT_STRATEGY);
        $collection->get('/route', 'SomeClass::someMethod');
        $dispatcher = $collection->getDispatcher();
        $response = $dispatcher->dispatch('GET', '/route');
        $this->assertEquals('hello world', $response->getContent());
    }