Phalcon\Test\Unit\Mvc\View\SimpleTest::testRenderWithPartials PHP Method

testRenderWithPartials() public method

Tests render with partials
Since: 2014-05-28
Author: Kamil Skowron ([email protected])
    public function testRenderWithPartials()
    {
        $this->specify('Render with partials does not work as expected', function () {
            $view = new Simple();
            $view->setViewsDir(PATH_DATA . 'views' . DIRECTORY_SEPARATOR);
            $expectedParams = ['cool_var' => 'FooBar'];
            $this->renderPartialBuffered($view, 'partials/_partial1', $expectedParams);
            expect($view->getContent())->equals('Hey, this is a partial, also FooBar');
            $view->setVars($expectedParams);
            expect($view->render('test5/index'))->equals('Hey, this is a partial, also FooBar');
            expect($view->render('test9/index'))->equals('Hey, this is a partial, also FooBar<br />Hey, this is a second partial, also FooBar');
        });
    }