run() public method

Invokes run() on all of the held test cases, instantiating them if necessary.
public run ( SimpleReporter $reporter )
$reporter SimpleReporter Current test reporter.
 /**
  * Genereates a nice report of the test.
  *
  * It instantiate a SimpleTest TestSuite and launches a Reporter.
  * This method is typically called by a TestRunner.
  *
  * @return void
  * @see    KortTestRunner
  * @see    KortCliReporter
  * @see    KortHTMLReporter
  */
 public function report()
 {
     $test = new \TestSuite($this->getLabel());
     $test->add($this);
     if (\TextReporter::inCli()) {
         exit($test->run(new KortCliReporter()) ? 0 : 1);
     }
     $test->run(new KortHTMLReporter());
 }
 public static function call_simpletest($task, $type = 'text', $dirs = array())
 {
     // remove E_STRICT because simpletest is not E_STRICT compatible
     $old_error_reporting = error_reporting();
     $new_error_reporting = $old_error_reporting;
     if ($new_error_reporting & E_STRICT) {
         $new_error_reporting = $new_error_reporting ^ E_STRICT;
     }
     include_once 'simpletest/unit_tester.php';
     include_once 'simpletest/web_tester.php';
     if (!class_exists('TestSuite')) {
         throw new pakeException('You must install SimpleTest to use this task.');
     }
     require_once 'simpletest/reporter.php';
     require_once 'simpletest/mock_objects.php';
     set_include_path('test' . PATH_SEPARATOR . 'lib' . PATH_SEPARATOR . get_include_path());
     $base_test_dir = 'test';
     $test_dirs = array();
     // run tests only in these subdirectories
     if ($dirs) {
         foreach ($dirs as $dir) {
             $test_dirs[] = $base_test_dir . DIRECTORY_SEPARATOR . $dir;
         }
     } else {
         $test_dirs[] = $base_test_dir;
     }
     $test = new TestSuite('Test suite in (' . implode(', ', $test_dirs) . ')');
     $files = pakeFinder::type('file')->name('*Test.php')->in($test_dirs);
     if (count($files) > 0) {
         foreach ($files as $file) {
             $test->addFile($file);
         }
         ob_start();
         if ($type == 'html') {
             $result = $test->run(new HtmlReporter());
         } else {
             if ($type == 'xml') {
                 $result = $test->run(new XmlReporter());
             } else {
                 $result = $test->run(new TextReporter());
             }
         }
         $content = ob_get_contents();
         ob_end_clean();
         if ($task->is_verbose()) {
             echo $content;
         }
     } else {
         throw new pakeException('No test to run.');
     }
     error_reporting($old_error_reporting);
 }
 /**
  * Extend run() method to recognize cli mode.
  *
  * @param SimpleReporter Reporter for HTML mode
  * @param SimpleReporter Reporter for CLI mode
  * @access public
  */
 function run(&$htmlReporter, &$cliReporter)
 {
     if (EvoTextReporter::inCli()) {
         exit(parent::run($cliReporter) ? 0 : 1);
     }
     parent::run($htmlReporter);
 }
Beispiel #4
0
 function runAllTests()
 {
     $test = new TestSuite();
     $test->addTestFile($this->webTestDir . 'wtest_uploadform.php');
     $test->addTestFile($this->webTestDir . 'wtest_loginform.php');
     $test->run(new HtmlReporter());
 }
Beispiel #5
0
 function run(&$reporter)
 {
     global $UNITTEST;
     $UNITTEST->running = true;
     $return = parent::run($reporter);
     unset($UNITTEST->running);
     return $return;
 }
Beispiel #6
0
 function runTests()
 {
     if (php_sapi_name() === "cli") {
         $reporter = new TextReporter();
     } else {
         parent::run(new HTMLReporter());
     }
     parent::run($reporter);
 }
Beispiel #7
0
 function __construct()
 {
     parent::TestSuite("All Generic Tephlon Tests");
     $tFiles = glob("*Test.php");
     foreach ($tFiles as $f) {
         echo "adding {$f}";
         parent::addFile($f);
         parent::run(new TextReporter());
     }
 }
Beispiel #8
0
 /**
  * Runs the indicated test case in isolation with the
  * URI: /simpletests/test/path/to/filename
  *
  * For example, to run test_user.php, indicate the path relative to the "tests" directory.
  * http://hostname/test/model/test_user.php
  */
 function test()
 {
     $nodes = Router::$segments;
     unset($nodes[0]);
     unset($nodes[1]);
     $path = implode('/', $nodes);
     $test = new TestSuite("Test " . $path);
     $test->addTestFile(APPPATH . "tests/" . $path);
     $test->run(new HtmlReporter());
 }
Beispiel #9
0
 /**
  * To execute callback if specified
  *
  * @param \PHPUnit_Framework_TestResult $result
  * @return \PHPUnit_Framework_TestResult
  */
 public function run(\PHPUnit_Framework_TestResult $result = null)
 {
     if ($this->callback) {
         $processManager = ProcessManager::factory();
         if ($processManager->isParallelModeSupported()) {
             $processManager->applyAppState($this->callback, $this->callbackArguments);
         } else {
             call_user_func_array($this->callback, $this->callbackArguments);
         }
     }
     return parent::run($result);
 }
 public static function call_simpletest(pakeTask $task, $type = 'text', $dirs = array())
 {
     if (!class_exists('TestSuite')) {
         throw new pakeException('You must install SimpleTest to use this task.');
     }
     SimpleTest::ignore('UnitTestCase');
     $base_test_dir = 'test';
     $test_dirs = array();
     // run tests only in these subdirectories
     if ($dirs) {
         foreach ($dirs as $dir) {
             $test_dirs[] = $base_test_dir . DIRECTORY_SEPARATOR . $dir;
         }
     } else {
         $test_dirs[] = $base_test_dir;
     }
     $files = pakeFinder::type('file')->name('*Test.php')->in($test_dirs);
     if (count($files) == 0) {
         throw new pakeException('No test to run.');
     }
     $test = new TestSuite('Test suite in (' . implode(', ', $test_dirs) . ')');
     foreach ($files as $file) {
         $test->addFile($file);
     }
     ob_start();
     if ($type == 'html') {
         $result = $test->run(new HtmlReporter());
     } else {
         if ($type == 'xml') {
             $result = $test->run(new XmlReporter());
         } else {
             $result = $test->run(new TextReporter());
         }
     }
     $content = ob_get_contents();
     ob_end_clean();
     if ($task->is_verbose()) {
         echo $content;
     }
 }
Beispiel #11
0
 public function testContentOfRecorderWithOnePassAndOneFailure()
 {
     $test = new TestSuite();
     $test->addFile(dirname(__FILE__) . '/support/recorder_sample.php');
     $recorder = new Recorder(new SimpleReporter());
     $test->run($recorder);
     $this->assertEqual(count($recorder->results), 2);
     $this->assertIsA($recorder->results[0], 'SimpleResultOfPass');
     $this->assertEqual('testTrueIsTrue', array_pop($recorder->results[0]->breadcrumb));
     $this->assertPattern('/ at \\[.*\\Wrecorder_sample\\.php line 9\\]/', $recorder->results[0]->message);
     $this->assertIsA($recorder->results[1], 'SimpleResultOfFail');
     $this->assertEqual('testFalseIsTrue', array_pop($recorder->results[1]->breadcrumb));
     $this->assertPattern("/Expected false, got \\[Boolean: true\\] at \\[.*\\Wrecorder_sample\\.php line 14\\]/", $recorder->results[1]->message);
 }
Beispiel #12
0
 function runAllTests()
 {
     $test = new TestSuite();
     /*//$test->addTestFile(dirname(__FILE__).'/testcrud.php');
     		$test->addTestFile(dirname(__FILE__).'/testdatabase.php');
     		$test->addTestFile(dirname(__FILE__).'/testcrudasmodel.php');
     		//$test->addTestFile(dirname(__FILE__).'/testusersignup.php'); obselete - users store themselves
     		$test->addTestFile(dirname(__FILE__).'/testupload.php');
     		$test->addTestFile(dirname(__FILE__).'/testscript.php');
     		$test->addTestFile(dirname(__FILE__).'/testmarkjson.php');
     		$test->addTestFile(dirname(__FILE__).'/testpayment.php');
     		$test->addTestFile(dirname(__FILE__).'/testpagegroup.php');*/
     $test->addTestFile(dirname(__FILE__) . '/testscript.php');
     $test->run(new HtmlReporter());
 }
Beispiel #13
0
 function testPass()
 {
     $listener = new MockSimpleSocket();
     $fullpath = realpath(dirname(__FILE__) . '/support/test1.php');
     $testpath = EclipseReporter::escapeVal($fullpath);
     $expected = "{status:\"pass\",message:\"pass1 at [{$testpath} line 4]\",group:\"{$testpath}\",case:\"test1\",method:\"test_pass\"}";
     //this should work...but it doesn't so the next line and the last line are the hacks
     //$listener->expectOnce('write',array($expected));
     $listener->setReturnValue('write', -1);
     $pathparts = pathinfo($fullpath);
     $filename = $pathparts['basename'];
     $test = new TestSuite($filename);
     $test->addTestFile($fullpath);
     $test->run(new EclipseReporter($listener));
     $this->assertEqual($expected, $listener->output);
 }
 protected function Form_Create()
 {
     $filesToSkip = array("QUnitTestCaseBase.php", "QTestForm.tpl.php");
     $arrFiles = QFolder::listFilesInFolder(__QCUBED_CORE__ . '/tests/qcubed-unit/');
     $arrTests = array();
     foreach ($arrFiles as $filename) {
         if (!in_array($filename, $filesToSkip)) {
             require_once __QCUBED_CORE__ . '/tests/qcubed-unit/' . $filename;
             $arrTests[] = str_replace(".php", "", $filename);
         }
     }
     $suite = new TestSuite('QCubed ' . QCUBED_VERSION_NUMBER_ONLY . ' Unit Tests - SimpleTest ' . SimpleTest::getVersion());
     foreach ($arrTests as $className) {
         $suite->add(new $className($this));
     }
     $suite->run(new QHtmlReporter());
 }
Beispiel #15
0
 function run($reporter)
 {
     $only = require_get("only", false);
     // we just load all PHP files within this directory
     if ($handle = opendir('.')) {
         echo "<ul style=\"padding: 10px; list-style: none;\">";
         echo "<li style=\"display: inline-block; margin-right: 5px;\"><a href=\"" . url_for('tests/') . "\"><b>All tests</b></a></li>\n";
         while (false !== ($entry = readdir($handle))) {
             if ($entry != "." && $entry != ".." && substr(strtolower($entry), -4) == ".php" && strtolower($entry) != 'index.php') {
                 echo "<li style=\"display: inline-block; margin-right: 5px;\"><a href=\"" . url_for('tests/', array('only' => $entry)) . "\">" . htmlspecialchars($entry) . "</a></li>\n";
             }
         }
         echo "</ul>";
         closedir($handle);
     }
     parent::run($reporter);
 }
 /**
  * Runs all the unit tests we can find
  */
 public function runAction()
 {
     /** FIXME: just a quick draft, copied from another file
     			and not expected to work. */
     $view = Zend_Registry::getInstance()->view;
     $registry = Zend_Registry::getInstance();
     $path = realpath($registry->configuration->unittest->dir);
     //$template = 'list/testcases.tpl';
     /// copied from test_all.php in simpletest folder
     $suite = new TestSuite('All tests');
     /// TODO for all tests matching TestOf.+/.class/.php in folder {
     // $suite->addTestCase( new Class in file );
     $suite->addTestCase(new TestOfSimpleTest());
     /// }
     //$suite->addTestCase(new TestOfRequestHandle());
     $suite->run(new HtmlReporter());
     /////////////
 }
Beispiel #17
0
 function testContentOfRecorderWithOnePassAndOneFailure()
 {
     $test = new TestSuite();
     $test->addFile(dirname(__FILE__) . '/sample.php');
     $recorder = new Recorder();
     $test->run($recorder);
     $this->assertEqual(count($recorder->results), 2);
     $d = '[\\\\\\/]';
     // backslash or slash
     $this->assertEqual(count($recorder->results[0]), 4);
     $this->assertPattern("/" . substr(time(), 9) . "/", $recorder->results[0]['time']);
     $this->assertEqual($recorder->results[0]['status'], "Passed");
     $this->assertPattern("/sample\\.php->SampleTestForRecorder->testTrueIsTrue/i", $recorder->results[0]['test']);
     $this->assertPattern("/ at \\[.*recorder{$d}test{$d}sample\\.php line 7\\]/", $recorder->results[0]['message']);
     $this->assertEqual(count($recorder->results[1]), 4);
     $this->assertPattern("/" . substr(time(), 9) . "/", $recorder->results[1]['time']);
     $this->assertEqual($recorder->results[1]['status'], "Failed");
     $this->assertPattern("/sample\\.php->SampleTestForRecorder->testFalseIsTrue/i", $recorder->results[1]['test']);
     $this->assertPattern("/Expected false, got \\[Boolean: true\\] at \\[.*recorder{$d}test{$d}sample\\.php line 11\\]/", $recorder->results[1]['message']);
 }
Beispiel #18
0
if (defined('STDIN') && count($argv) > 1) {
    if ($argv[1] == 'noseeds') {
        $test_seeds = false;
    }
}
$test = new TestSuite('All tests');
// All tests should be of the form NNN_description.php
// Notably, this excludes all.php and base.php, which are special
$test_files = glob(dirname(__FILE__) . "/*_*.php");
foreach ($test_files as $file) {
    $go = true;
    if (strpos($file, 'Seed') && !$test_seeds) {
        $go = false;
    }
    if ($go) {
        $test->addFile($file);
    }
}
if (TextReporter::inCli()) {
    echo "\n\n";
    $code = $test->run(new TextReporter()) ? 0 : 1;
    if ($code == 0) {
        echo "\nResult: PASS\n";
    } else {
        echo "\nResult: FAIL\n";
    }
    exit($code);
}
?>

 function single()
 {
     $rep = $this->_prepareResponse();
     $module = $this->param('mod');
     $testname = $this->param('test');
     $category = $this->category ? ' ' . $this->category : '';
     if (isset($this->testsList[$module])) {
         $reporter = jClasses::create($this->responseType);
         jClasses::inc('junittests~junittestcase');
         jClasses::inc('junittests~junittestcasedb');
         $reporter->setResponse($rep);
         foreach ($this->testsList[$module] as $test) {
             if ($test[1] == $testname) {
                 $group = new TestSuite('"' . $module . '" module , ' . $test[2]);
                 $group->addFile(jApp::config()->_modulesPathList[$module] . 'tests/' . $test[0]);
                 jApp::pushCurrentModule($module);
                 $result = $group->run($reporter);
                 if (!$result) {
                     $rep->setExitCode(jResponseCmdline::EXIT_CODE_ERROR);
                 }
                 jApp::popCurrentModule();
                 break;
             }
         }
     } else {
         $this->output("\n" . 'no' . $category . ' tests for "' . $module . '" module.' . "\n");
     }
     return $this->_finishResponse($rep);
 }
Beispiel #20
0
        $this->assertTrue(defined('Redis::OPT_READ_TIMEOUT'));
        $this->redis->setOption(Redis::OPT_READ_TIMEOUT, "12.3");
        $this->assertEquals(12.3, $this->redis->getOption(Redis::OPT_READ_TIMEOUT));
    }
    public function testIntrospection()
    {
        // Simple introspection tests
        $this->assertTrue($this->redis->getHost() === self::HOST);
        $this->assertTrue($this->redis->getPort() === self::PORT);
        $this->assertTrue($this->redis->getAuth() === self::AUTH);
    }
    private function isLeveldbEnabled()
    {
        return isset($this->leveldb_version) && version_compare($this->leveldb_version, '1', 'ge');
    }
    public function testDsIncrby()
    {
        if (!$this->isLeveldbEnabled()) {
            $this->markTestSkipped();
        }
        $this->redis->dsDel('key');
        $this->redis->dsIncrby('key', 1);
        $this->assertEquals(1, (int) $this->redis->dsGet('key'));
        $this->redis->dsIncrby('key', 2);
        $this->assertEquals(3, (int) $this->redis->dsGet('key'));
        $this->redis->dsIncrby('key', -1);
        $this->assertEquals(2, (int) $this->redis->dsGet('key'));
    }
}
exit(TestSuite::run("Redis_Test"));
Beispiel #21
0
$model_tests->add(new TestOfUserErrorMySQLDAO());
$model_tests->add(new TestOfUtils());
$model_tests->add(new TestOfWebapp());
$model_tests->add(new TestOfMenuItem());
$model_tests->add(new TestOfDataset());
$model_tests->add(new TestOfPostIterator());
$model_tests->add(new TestOfMutexMySQLDAO());
$model_tests->add(new TestOfBackupMySQLDAO());
$model_tests->add(new TestOfFavoritePostMySQLDAO());
$model_tests->add(new TestOfStreamDataMySQLDAO());
$model_tests->add(new TestOfStreamProcMySQLDAO());
$model_tests->add(new TestOfHashtagMySQLDAO());
$model_tests->add(new TestOfMentionMySQLDAO());
$model_tests->add(new TestOfPlaceMySQLDAO());
$model_tests->add(new TestOfPDODAO());
$model_tests->add(new TestOfURLProcessor());
$model_tests->add(new TestOfTableStatsMySQLDAO());
$tr = new TextReporter();
list($usec, $sec) = explode(" ", microtime());
$start = (double) $usec + (double) $sec;
$model_tests->run($tr);
if (getenv("TEST_TIMING") == "1") {
    list($usec, $sec) = explode(" ", microtime());
    $finish = (double) $usec + (double) $sec;
    $runtime = round($finish - $start);
    printf("Tests completed run in {$runtime} seconds\n");
}
if (isset($RUNNING_ALL_TESTS) && $RUNNING_ALL_TESTS) {
    $TOTAL_PASSES = $TOTAL_PASSES + $tr->getPassCount();
    $TOTAL_FAILURES = $TOTAL_FAILURES + $tr->getFailCount();
}
<?php

/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2015/9/14
 * Time: 16:43
 */
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . "TestSuite.php";
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . "InterfaceTest.php";
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . "ProcessTest.php";
TestSuite::run("InterfaceTest");
TestSuite::run("ProcessTest");
Beispiel #23
0
"><?php 
    echo str_replace(TESTS_DIR, '', $file);
    ?>
</option>
					<?php 
}
?>
				</select>
				<input type="submit" value="Run" />
			</form>
		</div>
	</div>


	<div id="report">
		<?php 
$test_suite->run(new MyReporter());
?>
	</div>

	<div id="footer">
		Tests ran in <?php 
echo $elapse_time;
?>
 seconds, using <?php 
echo memory_usage();
?>
	</div>

</body>
</html>
Beispiel #24
0
 /**
  * Run the tests, returning the reporter output.
  */
 public function Run()
 {
     // Save superglobals that might be tested.
     if (isset($_SESSION)) {
         $oldsession = $_SESSION;
     }
     $oldrequest = $_REQUEST;
     $oldpost = $_POST;
     $oldget = $_GET;
     $oldfiles = $_FILES;
     $oldcookie = $_COOKIE;
     $group_test = new TestSuite($this->testTitle);
     // Add files in tests_dir
     if (is_dir($this->testDir)) {
         if ($dh = opendir($this->testDir)) {
             while (($file = readdir($dh)) !== FALSE) {
                 // Test if file ends with php, then include it.
                 if (substr($file, -(strlen($this->fileExtension) + 1)) == '.' . $this->fileExtension) {
                     $group_test->addFile($this->testDir . "/{$file}");
                 }
             }
             closedir($dh);
         }
     }
     // Start the tests
     ob_start();
     $group_test->run(new $this->Reporter());
     $output_buffer = ob_get_clean();
     // Restore superglobals
     if (isset($oldsession)) {
         $_SESSION = $oldsession;
     }
     $_REQUEST = $oldrequest;
     $_POST = $oldpost;
     $_GET = $oldget;
     $_FILES = $oldfiles;
     $_COOKIE = $oldcookie;
     return $output_buffer;
 }
$controller_test->add(new TestOfExportController());
$controller_test->add(new TestOfExportServiceUserDataController());
$controller_test->add(new TestOfForgotPasswordController());
$controller_test->add(new TestOfGridController());
$controller_test->add(new TestOfGridExportController());
$controller_test->add(new TestOfInstallerController());
$controller_test->add(new TestOfLoginController());
$controller_test->add(new TestOfLogoutController());
$controller_test->add(new TestOfPasswordResetController());
$controller_test->add(new TestOfPostController());
$controller_test->add(new TestOfRegisterController());
$controller_test->add(new TestOfTestController());
$controller_test->add(new TestOfTestAuthController());
$controller_test->add(new TestOfTestAdminController());
$controller_test->add(new TestOfToggleActiveInstanceController());
$controller_test->add(new TestOfToggleActiveOwnerController());
$controller_test->add(new TestOfToggleActivePluginController());
$controller_test->add(new TestOfTogglePublicInstanceController());
$controller_test->add(new TestOfUserController());
$controller_test->add(new TestOfPluginOptionController());
$controller_test->add(new TestOfTestAuthAPIController());
$controller_test->add(new TestOfRSSController());
$controller_test->add(new TestOfUpgradeController());
$controller_test->add(new TestOfPostAPIController());
$controller_test->add(new TestOfStreamerAuthController());
$tr = new TextReporter();
$controller_test->run($tr);
if (isset($RUNNING_ALL_TESTS) && $RUNNING_ALL_TESTS) {
    $TOTAL_PASSES = $TOTAL_PASSES + $tr->getPassCount();
    $TOTAL_FAILURES = $TOTAL_FAILURES + $tr->getFailCount();
}
Beispiel #26
0
 /**
  * Runs a specific group test file
  *
  * @param string $groupTestName
  * @param string $reporter
  * @return void
  * @access public
  */
 function runGroupTest($groupTestName, &$reporter)
 {
     $manager = new TestManager();
     $filePath = $manager->_getTestsPath('groups') . DS . strtolower($groupTestName) . $manager->_groupExtension;
     if (!file_exists($filePath)) {
         trigger_error("Group test {$groupTestName} cannot be found at {$filePath}", E_USER_ERROR);
     }
     require_once $filePath;
     $test = new TestSuite($groupTestName . ' group test');
     foreach ($manager->_getGroupTestClassNames($filePath) as $groupTest) {
         $testCase = new $groupTest();
         $test->addTestCase($testCase);
         if (isset($testCase->label)) {
             $test->_label = $testCase->label;
         }
     }
     return $test->run($reporter);
 }
$plugin_tests->add(new TestOfTwitterAgeInsight());
$plugin_tests->add(new TestOfTwitterBirthdayInsight());
$plugin_tests->add(new TestOfPhotoPromptInsight());
$plugin_tests->add(new TestOfExclamationCountInsight());
$plugin_tests->add(new TestOfMetaPostsCountInsight());
$plugin_tests->add(new TestOfFacebookProfilePromptInsight());
$plugin_tests->add(new TestOfLocationAwarenessInsight());
$plugin_tests->add(new TestOfBioTrackerInsight());
$plugin_tests->add(new TestOfNewDictionaryWordsInsight());
$plugin_tests->add(new TestOfFollowerComparisonInsight());
$plugin_tests->add(new TestOfDiversifyLinksInsight());
//$plugin_tests->add(new TestOfAgeAnalysisInsight());
$plugin_tests->add(new TestOfTopWordsInsight());
$plugin_tests->add(new TestOfBestieInsight());
// Don't run the developer insight test every time
// $plugin_tests->add(new TestOfHelloThinkUpInsight());
$tr = new TextReporter();
$start = (double) $usec + (double) $sec;
$plugin_tests->run($tr);
if (getenv("TEST_TIMING") == "1") {
    list($usec, $sec) = explode(" ", microtime());
    $finish = (double) $usec + (double) $sec;
    $runtime = round($finish - $start);
    printf("Tests completed run in {$runtime} seconds\n");
}
if (isset($RUNNING_ALL_TESTS) && $RUNNING_ALL_TESTS) {
    if (isset($TOTAL_PASSES) && isset($TOTAL_FAILURES)) {
        $TOTAL_PASSES = $TOTAL_PASSES + $tr->getPassCount();
        $TOTAL_FAILURES = $TOTAL_FAILURES + $tr->getFailCount();
    }
}
Beispiel #28
0
<?php

// $Id$
require_once dirname(__FILE__) . '/../default_server.php';
require_once dirname(__FILE__) . '/../remote.php';
require_once dirname(__FILE__) . '/../reporter.php';
// nasty hack: ensure the commanline i processed before anything else in here so that the default server URI can indeed be set by the user:
$ignore_me = new DefaultReporter();
// The following URL will depend on your own installation.
$test_url = str_replace('site/', 'visual_test.php', WebserverDefaults::getServerUrl());
if (isset($_SERVER['SCRIPT_URI'])) {
    $base_uri = $_SERVER['SCRIPT_URI'];
    $test_url = str_replace('remote_test.php', 'visual_test.php', $base_uri);
} elseif (isset($_SERVER['HTTP_HOST']) && isset($_SERVER['PHP_SELF'])) {
    $base_uri = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
    $test_url = str_replace('remote_test.php', 'visual_test.php', $base_uri);
}
$test = new TestSuite('Remote tests');
$test->add(new RemoteTestCase($test_url . '?xml=yes', $test_url . '?xml=yes&dry=yes'));
if (SimpleReporter::inCli()) {
    exit($test->run(new NoPassesReporter(new TextReporter())) ? 0 : 1);
}
$test->run(new NoPassesReporter(new HtmlReporter()));
<?php

// $Id$
require_once '../unit_tester.php';
require_once '../reporter.php';
$test = new TestSuite('This should fail');
$test->addFile('test_with_parse_error.php');
$test->run(new NoPassesReporter(new HtmlReporter()));
Beispiel #30
0
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
# load required files
require_once 'simpletest/unit_tester.php';
require_once 'simpletest/reporter.php';
require_once 'simpletest/collector.php';
require_once 'simpletest/mock_objects.php';
require_once 'varstream.php';
$project_path = dirname(dirname(__FILE__));
$lib_path = $project_path . '/lib/src/';
# load required files
require_once $lib_path . 'dispatcher.php';
require_once $lib_path . 'response.php';
require_once $lib_path . 'controller.php';
require_once $lib_path . 'inflector.php';
require_once $lib_path . 'flash.php';
require_once $lib_path . 'exception.php';
# load flexi lib
require_once $project_path . '/vendor/flexi/flexi.php';
# load all mocks
require_once 'lib/mocks.php';
# collect all tests
$all = new TestSuite('All tests');
$all->collect(dirname(__FILE__) . '/lib', new SimplePatternCollector('/test.php$/'));
# use text reporter if cli
if (sizeof($_SERVER['argv'])) {
    $all->run(new TextReporter());
} else {
    $all->run(new HtmlReporter());
}