Bolt\Tests\Controller\FrontendTest::testPreview PHP Method

testPreview() public method

public testPreview ( )
    public function testPreview()
    {
        $this->setRequest(Request::create('/pages'));
        $this->controller()->listing($this->getRequest(), 'pages/test');
        $templates = $this->getMockBuilder(TemplateChooser::class)->setMethods(['record'])->setConstructorArgs([$this->getApp()])->getMock();
        $templates->expects($this->any())->method('record')->will($this->returnValue('record.twig'));
        $this->setService('templatechooser', $templates);
        $response = $this->controller()->preview($this->getRequest(), 'pages');
        $this->assertTrue($response instanceof TemplateResponse);
        $this->assertSame('record.twig', $response->getTemplate()->getTemplateName());
        $this->assertNotEmpty($response->getGlobals());
    }