public function testCache() { $cacheAdapter = new InMemory(array()); $this->app['finder.cache.adapter'] = $cacheAdapter; $cache = new Filesystem($cacheAdapter); $this->assertEmpty($cache->keys()); // exec without cache $this->runCommand('rollback', array('sourcePath' => 'src/')); $this->assertEmpty($cache->keys()); // exec with cache $this->runCommand('rollback', array('--cache' => true, 'sourcePath' => 'src/')); $this->assertNotEmpty($cache->keys()); }
/** * {@inheritDoc} */ public function clearCache($maxAge) { $delTime = time() - (int) $maxAge; $num = 0; foreach ($this->temporaryFilesystem->keys() as $key) { if (!$this->temporaryFilesystem->getAdapter()->isDirectory($key)) { if ($delTime > $this->temporaryFilesystem->mtime($key)) { $this->temporaryFilesystem->delete($key); $num++; } } } return $num; }
/** * @test * @group functional */ public function shouldWorkWithHiddenFiles() { $this->filesystem->write('.foo', 'hidden'); $this->assertTrue($this->filesystem->has('.foo')); $this->assertContains('.foo', $this->filesystem->keys()); $this->filesystem->delete('.foo'); $this->assertFalse($this->filesystem->has('.foo')); }
/** * @test * @group functional */ public function shouldFetchKeys() { $this->assertEquals(array(), $this->filesystem->keys()); $this->filesystem->write('foo', 'Some content'); $this->filesystem->write('bar', 'Some content'); $this->filesystem->write('baz', 'Some content'); $actualKeys = $this->filesystem->keys(); $this->assertEquals(3, count($actualKeys)); foreach (array('foo', 'bar', 'baz') as $key) { $this->assertContains($key, $actualKeys); } }