/** * auxiliary function to include requested adapter * * @param string $type * @return boolean */ private static function loadAdapter($name) { // already loaded if (class_exists(self::getAdapterClassName($name))) { return true; } $classFile = PHPFIT_Fixture::fc_incpath('file_exists', self::getAdapterClassFile($name)); if (false === $classFile) { return false; } require_once self::getAdapterClassFile($name); return class_exists(self::getAdapterClassName($name)); }
/** * run test * * Process all tables in input file and store result in output file. * * Example: * <pre> * $fr = new FileRunner(); * $fr->run( 'infilt.html', 'outfile.html' ); * </pre> * * @param string $in path to input file * @param string $out path to output file * @param string $fixturesDirectory path to fixtures * @return string results */ public function run($in, $out, $fixturesDirectory = null) { date_default_timezone_set('UTC'); // check input file if (!PHPFIT_Fixture::fc_incpath('file_exists', $in) || !PHPFIT_Fixture::fc_incpath('is_readable', $in) || !$in) { throw new PHPFIT_Exception_FileIO('Input file does not exist!', $in); } // check output file if (!self::isWritable($out)) { throw new PHPFIT_Exception_FileIO('Output file is not writable ' . '(probably a problem of file permissions)', $out); } // summary data $this->fixture->summary['input file'] = $in; $this->fixture->summary['output file'] = $out; $this->fixture->summary['input update'] = PHPFIT_Fixture::getDateString(filemtime(realpath($in))) . '.'; // load input data $this->input = file_get_contents($in, true); $result = $this->process($fixturesDirectory); // save output file_put_contents($out, $this->tables->toString(), true); return $result; }
/** * @param string $filename * @return boolean */ protected static function canLoadFile($filename) { return PHPFIT_Fixture::fc_incpath('is_readable', $filename); }
function loadFile($javaStylishName) { $filename = str_replace('.', '/', $javaStylishName) . '.php'; $dir = rtrim($this->fixturesDirectory, '/\\') . '/'; if (PHPFIT_Fixture::fc_incpath('is_readable', $dir . $filename)) { return require_once $dir . $filename; } $this->checkFixtureName(subStr($javaStylishName, 6)); return require_once subStr($filename, 6); }