public function tearDown() { PHPFIT::run($this->runFilename, $this->isFilename); $must = file_get_contents($this->mustFilename, true); $is = file_get_contents($this->isFilename, true); $this->assertEqual($is, $must); }
public function tearDown() { PHPFIT::run($this->runFilename, $this->isFilename); $must = str_replace("\r\n", "\n", file_get_contents($this->mustFilename, true)); $is = str_replace("\r\n", "\n", file_get_contents($this->isFilename, true)); $this->assertEquals($is, $must); }
<?php use fitshelf\ClassLoader; require_once 'config/config.php'; require_once '../src/fitshelf/ClassLoader.php'; require_once 'PHPFIT.php'; if (!isset($_GET['input_filename'])) { die('no input file received!'); } $loader = new ClassLoader(); $loader->setSpaceMap($fitConfig->nameSpacedMap); $loader->registerAutoLoad(); $unSafe = $_GET['input_filename']; foreach ($fitConfig->exampleDirs as $safe) { if (subStr($unSafe, 0, strLen($safe)) == $safe) { //begins with example dir path $unSafe = ltrim(subStr($unSafe, strLen($safe)), '/'); break; } } if ($unSafe[0] == '/' || strPos($unSafe, '..') !== false || preg_match("'[^A-Za-z0-9_\\-./]'", $unSafe)) { die("Unsafe file name: " . $_GET['input_filename']); } PHPFIT::run($_GET['input_filename'], $fitConfig->output); //PHPFIT is autoloaded because it is in the includepath echo file_get_contents($fitConfig->output, true);
<?php //usage: php run-cli.php input/Fig1TestDisconnect.html require_once 'config/config.php'; require_once '../src/fitshelf/ClassLoader.php'; require_once 'PHPFIT.php'; if (count($argv) < 2) { fwrite(STDERR, "Invalid number of arguments!!!\nUsage: phpfit path/to/input.html [path/to/output.html] [paths/to/fixtures]\n"); return 1; } $loader = new fitshelf\ClassLoader(); $loader->setSpaceMap($fitConfig->nameSpacedMap); $loader->registerAutoLoad(); $output = isset($argv[2]) ? $argv[2] : 'output.html'; $fixturesDir = isset($argv[3]) ? $argv[3] : null; echo PHPFIT::run($argv[1], $output, $fixturesDir) . "\n";
<?php error_reporting(E_ALL | E_STRICT); require_once 'PHPFIT.php'; if (!isset($_GET['input_filename'])) { die('no input file received!'); } $output = 'output.html'; PHPFIT::run($_GET['input_filename'], $output); echo file_get_contents($output, true);