Phrozn\Site\View\Textile::getOutputFile PHP Method

getOutputFile() public method

Get output file path
public getOutputFile ( ) : string
return string
    public function getOutputFile()
    {
        if (!$this->outputFile) {
            $path = new OutputFile($this);
            $this->setOutputFile($path->get());
        }
        return $this->outputFile;
    }

Usage Example

Example #1
0
    public function testViewCompiling()
    {
        $entry = dirname(__FILE__) . '/entries/textile.textile';
        $html = dirname(__FILE__) . '/entries/textile.html';
        $path = dirname(__FILE__) . '/out/'; 
        $view = new View($entry, $path);

        $this->assertSame('textile.textile', basename($view->getInputFile()));
        $this->assertSame('textile.html', basename($view->getOutputFile()));

        @unlink($path . 'textile.html');
        $this->assertFalse(is_readable($path . 'textile.html'));

        $rendered = $view->compile();

        $this->assertTrue(is_readable($path . 'textile.html'));

        $loaded = file_get_contents($html);
        $this->assertSame(trim($loaded), trim($rendered));

        // load from out
        $loaded = file_get_contents($path . 'textile.html');
        $this->assertSame(trim($loaded), trim($rendered));

        // cleanup
        unlink($path . 'textile.html');
    }