Phalcon\Test\Unit\Mvc\ViewTest::testViewOptions PHP Method

testViewOptions() public method

public testViewOptions ( )
    public function testViewOptions()
    {
        $this->specify("Views are not cached properly when passing options to the constructor", function () {
            $this->_clearCache();
            $config = array('cache' => array('service' => 'otherCache'));
            $date = date("r");
            $content = '<html>' . $date . '</html>' . PHP_EOL;
            $di = $this->_getDi('otherCache');
            $view = new View($config);
            $view->setDI($di);
            $view->setViewsDir(PATH_DATA . 'views' . DIRECTORY_SEPARATOR);
            $view->setVar("date", $date);
            $view->start();
            $view->cache(true);
            $view->render('test8', 'other');
            $view->finish();
            expect($view->getContent())->equals($content);
            $view->reset();
            sleep(1);
            $view->setVar("date", date("r"));
            $view->start();
            $view->cache(true);
            $view->render('test8', 'other');
            $view->finish();
            expect($view->getContent())->equals($content);
        });
    }