public function prepareFolder() { $filesystem = new \Illuminate\Filesystem\Filesystem(); foreach ($filesystem->glob(TEST_PATH . DIRECTORY_SEPARATOR . '{,.}*', GLOB_BRACE) as $file) { switch (basename($file)) { case 'vendor': case 'composer.json': case '.': case '..': continue; default: if (is_dir($file)) { $filesystem->deleteDirectory($file); } else { $filesystem->delete($file); } } } }
/** * Remove old chunks */ protected function removeOldData($filePath) { if ($this->storage->exists($filePath) && $this->storage->lastModified($filePath) < time() - $this->maxFileAge) { $this->storage->delete($filePath); } }
<?php require_once __DIR__ . '/vendor/autoload.php'; $file = new Illuminate\Filesystem\Filesystem(); $parser = new Rtablada\LiterateRoutes\Parser(); $fileParser = new Rtablada\LiterateRoutes\FileParser($file, $parser); $expected = $file->get(__DIR__ . '/tests/files/route-full.php.test'); $fileParser->buildForDirectory(__DIR__ . '/tests'); $actual = $file->get(__DIR__ . '/tests/files/route-full.php'); if ($expected == $actual) { echo "File built correctly."; } else { echo "File build fail."; } $file->delete(__DIR__ . '/tests/files/route-full.php');