getOutputFile() public method

Get output file path
public getOutputFile ( ) : string
return string
Example #1
0
    public function testViewCompiling()
    {
        $jsIn = dirname(__FILE__) . '/scripts/jquery/test.js';
        $jsOut = dirname(__FILE__) . '/scripts/jquery/test.js';
        $path = dirname(__FILE__) . '/out'; 
        $view = new View($jsIn, $path);

        $this->assertSame('test.js', basename($view->getInputFile()));
        $this->assertSame('test.js', basename($view->getOutputFile()));

        @unlink($path . '/scripts/jquery/test.js');
        $this->assertFalse(is_readable($path . '/scripts/jquery/test.js'));

        $rendered = $view->compile();

        $this->assertTrue(is_readable($path . '/scripts/jquery/test.js'));

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

        // load from out
        $loaded = file_get_contents($path . '/scripts/jquery/test.js');
        $this->assertSame(trim($loaded), trim($rendered));

        // cleanup
        unlink($path . '/scripts/jquery/test.js');
    }