lithium\tests\cases\storage\cache\adapter\FileTest::testDeleteWithScope PHP Method

testDeleteWithScope() public method

public testDeleteWithScope ( )
    public function testDeleteWithScope()
    {
        $adapter = new File(array('scope' => 'primary'));
        $time = time() + 60;
        $keys = array('primary_key1' => 'test1', 'key1' => 'test2');
        foreach ($keys as $key => $data) {
            $path = Libraries::get(true, 'resources') . "/tmp/cache/{$key}";
            file_put_contents($path, "{:expiry:{$time}}\n{$data}");
        }
        $keys = array('key1');
        $adapter->delete($keys);
        $file = Libraries::get(true, 'resources') . "/tmp/cache/key1";
        $result = file_exists($file);
        $this->assertTrue($result);
        $file = Libraries::get(true, 'resources') . "/tmp/cache/primary_key1";
        $result = file_exists($file);
        $this->assertFalse($result);
    }