/** * Ensure that all fake data we use are valid FileStorage * data files. This should ensure, that fake backend and * other services depending on fake data will not encounter * broken data. */ public function testAllData() { $storage = new FileStorage(array("root_path" => "/")); $dir = fake_data::getDirectory(); $it = new RecursiveDirectoryIterator($dir); $nonrecursiveIt = new RecursiveIteratorIterator($it); $regexIt = new RegexIterator($nonrecursiveIt, '@\\.dat$@'); foreach ($regexIt as $file) { $this->assertTrue($file->isFile()); $key = $file->getPathname(); $key = preg_replace("@\\.dat\$@", "", $key); $data = $storage->read($key); $this->assertTrue(null !== $data); } }
/** * Ensure that all fake data we use are valid FileStorage * data files. This should ensure, that fake backend and * other services depending on fake data will not encounter * broken data. */ public function testAllData() { $dir = fake_data::getDirectory(); $storage = new FileStorage(array("root_path" => $dir . '/')); $it = new RecursiveDirectoryIterator($dir); $nonrecursiveIt = new RecursiveIteratorIterator($it); $regexIt = new RegexIterator($nonrecursiveIt, '@\\.dat$@'); foreach ($regexIt as $file) { $this->assertTrue($file->isFile()); $key = $file->getPathname(); assert(StrUtil::startsWith($key, $dir)); // remove $dir from beginning of $key $key = substr($key, strlen($dir)); $key = preg_replace("@\\.dat\$@", "", $key); $data = $storage->read($key); $this->assertTrue(null !== $data); } }