lithium\tests\cases\template\view\CompilerTest::testTemplateCacheHit PHP Метод

testTemplateCacheHit() публичный Метод

    public function testTemplateCacheHit()
    {
        $path = Libraries::get(true, 'resources') . '/tmp/cache/templates';
        $original = Compiler::template("{$this->_path}/{$this->_file}", compact('path'));
        $cache = glob("{$path}/*");
        clearstatcache();
        $cached = Compiler::template("{$this->_path}/{$this->_file}", compact('path'));
        $this->assertEqual($original, $cached);
        $this->assertEqual($cache, glob("{$path}/*"));
        file_put_contents("{$this->_path}/{$this->_file}", "Updated");
        clearstatcache();
        $updated = Compiler::template("{$this->_path}/{$this->_file}", compact('path'));
        $newCache = glob("{$path}/*");
        $this->assertNotEqual($cache, $updated);
        $this->assertEqual(count($cache), count($newCache));
        $this->assertNotEqual($cache, $newCache);
    }