PhroznTest\Site\View\CssTest::testViewCompiling PHP Method

testViewCompiling() public method

public testViewCompiling ( )
    public function testViewCompiling()
    {
        $css = dirname(__FILE__) . '/styles/style.css';
        $path = dirname(__FILE__) . '/out';
        $view = new View($css, $path);
        $view->setInputRootDir(dirname(__FILE__));
        $this->assertSame('style.css', basename($view->getInputFile()));
        $this->assertSame('style.css', basename($view->getOutputFile()));
        @unlink($path . '/styles/style.css');
        $this->assertFalse(is_readable($path . '/styles/style.css'));
        $rendered = $view->compile();
        $this->assertTrue(is_readable($path . '/styles/style.css'));
        $loaded = file_get_contents($css);
        $this->assertSame(trim($loaded), trim($rendered));
        // load from out
        $loaded = file_get_contents($path . '/styles/style.css');
        $this->assertSame(trim($loaded), trim($rendered));
        // cleanup
        unlink($path . '/styles/style.css');
    }