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

testFileAdapterMultipleStrategies() public method

    public function testFileAdapterMultipleStrategies()
    {
        $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(), 'strategies' => array('Serializer', 'Base64')));
        Cache::config($config);
        $data = array('some' => 'data');
        $time = time();
        $result = Cache::write('default', 'key', $data, "@{$time} +1 minute");
        $this->assertNotEmpty($result);
        $time = $time + 60;
        $result = file_get_contents("{$path}/key");
        $expected = "{:expiry:{$time}}\nYToxOntzOjQ6InNvbWUiO3M6NDoiZGF0YSI7fQ==";
        $this->assertEqual($result, $expected);
        $result = Cache::read('default', 'key');
        $this->assertEqual($data, $result);
        $result = unlink("{$path}/key");
        $this->assertTrue($result);
        $this->assertFileNotExists("{$path}/key");
    }