PopTest\Cache\CacheTest::testSaveAndLoad PHP Метод

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

public testSaveAndLoad ( )
    public function testSaveAndLoad()
    {
        if (!file_exists(__DIR__ . '/../tmp/cache')) {
            mkdir(__DIR__ . '/../tmp/cache');
            chmod(__DIR__ . '/../tmp/cache', 0777);
        }
        $str = 'This is my test variable. It contains a string.';
        $c = Cache::factory(new File(__DIR__ . '/../tmp/cache'), 30);
        $this->fileExists($c->adapter()->getDir());
        $c->save('str', $str);
        $this->assertEquals($str, $c->load('str'));
        $c->remove('str');
        $c->clear();
        if (file_exists(__DIR__ . '/../tmp/cache')) {
            rmdir(__DIR__ . '/../tmp/cache');
        }
    }