Phalcon\Test\Unit\Mvc\DispatcherTest::testDispatcherForward PHP Method

testDispatcherForward() public method

    public function testDispatcherForward()
    {
        $this->specify("MVC Dispatcher doesn't forward properly", function () {
            $di = new Di();
            //$di->set("response", new Response());
            $dispatcher = new Dispatcher();
            $dispatcher->setDI($di);
            $di->set("dispatcher", $dispatcher);
            $dispatcher->setControllerName("test2");
            $dispatcher->setActionName("index");
            $dispatcher->setParams([]);
            $dispatcher->forward(["controller" => "test3", "action" => "other"]);
            $value = $dispatcher->getControllerName();
            expect($value)->equals("test3");
            $value = $dispatcher->getActionName();
            expect($value)->equals("other");
            $value = $dispatcher->getPreviousNamespaceName();
            expect($value)->equals("");
            $value = $dispatcher->getPreviousControllerName();
            expect($value)->equals("test2");
            $value = $dispatcher->getPreviousActionName();
            expect($value)->equals("index");
        });
    }