lithium\tests\integration\storage\CacheTest::testFileAdapterWrite PHP Method

testFileAdapterWrite() public method

    public function testFileAdapterWrite()
    {
        $resources = Libraries::get(true, 'resources');
        $path = "{$resources}/tmp/cache";
        $this->skipIf(!$this->_checkPath(), "{$path} does not have the proper permissions.");
        $config = array('default' => compact('path') + array('adapter' => 'File', 'filters' => array()));
        Cache::config($config);
        $time = time();
        $result = Cache::write('default', 'key', 'value', "@{$time} +1 minute");
        $this->assertNotEmpty($result);
        $time = $time + 60;
        $result = file_get_contents("{$path}/key");
        $expected = "{:expiry:{$time}}\nvalue";
        $this->assertEqual($result, $expected);
        $result = unlink("{$path}/key");
        $this->assertTrue($result);
        $this->assertFileNotExists("{$path}/key");
    }