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

testGetControllerClass() public method

    public function testGetControllerClass()
    {
        $this->specify("MVC Dispatcher doesn't calculate the controller class properly", function () {
            $di = new Di();
            $dispatcher = new Dispatcher();
            $dispatcher->setDI($di);
            $di->set("dispatcher", $dispatcher);
            // With namespace
            $dispatcher->setNamespaceName("Foo\\Bar");
            $dispatcher->setControllerName("test");
            $value = $dispatcher->getControllerClass();
            expect($value)->equals("Foo\\Bar\\TestController");
            // Without namespace
            $dispatcher->setNamespaceName(null);
            $dispatcher->setControllerName("Test");
            $value = $dispatcher->getControllerClass();
            expect($value)->equals("TestController");
        });
    }