<?php
// Hoplite
-// Copyright (c) 2011 Blue Static
-//
+// Copyright (c) 2016 Blue Static
+//
// This program is free software: you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the Free
// Software Foundation, either version 3 of the License, or any later version.
-//
+//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
define('HOPLITE_ROOT', dirname(dirname(__FILE__)));
define('TEST_ROOT', dirname(__FILE__));
}
-
-// PHPUnit 3.5.5.
-require_once 'PHPUnit/Autoload.php';
-require_once TEST_ROOT . '/test_listener.php';
-
-class HopliteTestRunner extends \PHPUnit_TextUI_Command
-{
- static public function Main($exit = TRUE)
- {
- $command = new self();
- $command->Run($_SERVER['argv'], $exit);
- }
-
- protected function HandleCustomTestSuite()
- {
- $this->arguments['printer'] = new TestListener();
- }
-}
-
-HopliteTestRunner::Main();
<!--
Hoplite
Copyright (c) 2011 Blue Static
-
+
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the Free
Software Foundation, either version 3 of the License, or any later version.
-
+
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
-
+
You should have received a copy of the GNU General Public License along with
this program. If not, see <http://www.gnu.org/licenses/>.
-->
-<!-- Tested with PHPUnit 3.5.5 -->
+<!-- Tested with PHPUnit 5.6.7 -->
<phpunit backupGlobals="FALSE"
backupStaticAttributes="FALSE"
- colors="TRUE">
+ colors="TRUE"
+ bootstrap="bootstrap.php"
+ printerFile="test_listener.php"
+ printerClass="hoplite\test\TestListener"
+ verbose="TRUE">
<testsuites>
<testsuite name="Hoplite Unit Tests">
</testsuites>
<filter>
+ <whitelist>
+ <directory suffix=".php">../</directory>
+ </whitelist>
<blacklist>
<directory>./</directory> <!-- Don't get coverage for test files. -->
</blacklist>
</filter>
+ <!--
<logging>
<log type="coverage-html" target="./unittest_coverage" yui="TRUE" highlight="TRUE"/>
</logging>
+ -->
</phpunit>
// Array of incomplete tests.
private $incomplete = array();
+ private $risky = array();
// An error occurred.
public function addError(\PHPUnit_Framework_Test $test,
$this->_Print(' ', $e->GetMessage());
if ($e instanceof \PHPUnit_Framework_ExpectationFailedException) {
$comp = $e->GetComparisonFailure();
- if ($comp instanceof \PHPUnit_Framework_ComparisonFailure) {
+ if ($comp) {
$this->_Print(' ==> ', $comp->GetExpectedAsString());
$this->_Print('', 'does not match');
$this->_Print(' ==> ', $comp->GetActualAsString());
$this->failing[] = $test->ToString();
}
+ // Risky test.
+ public function addRiskyTest(\PHPUnit_Framework_Test $test,
+ \Exception $e, $time)
+ {
+ $this->risky[] = $test->ToString();
+ $this->_Print('RISKY', $e->GetMessage(), self::COLOR_PURPLE);
+ }
+
// Incomplete test.
public function addIncompleteTest(\PHPUnit_Framework_Test $test,
\Exception $e, $time)