Upgrade PHPUnit to 5.6.7.
authorRobert Sesek <rsesek@bluestatic.org>
Sun, 4 Dec 2016 04:29:14 +0000 (23:29 -0500)
committerRobert Sesek <rsesek@bluestatic.org>
Sun, 4 Dec 2016 04:29:14 +0000 (23:29 -0500)
testing/bootstrap.php [moved from testing/test_runner.php with 62% similarity]
testing/phpunit.xml
testing/test_listener.php

similarity index 62%
rename from testing/test_runner.php
rename to testing/bootstrap.php
index 0be30f8c0042327eedf76531f188c147d39cbd27..eb090e9aa15fde6afdf8223baf3db009ccc56123 100644 (file)
@@ -1,11 +1,11 @@
 <?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
@@ -20,23 +20,3 @@ if (!defined('HOPLITE_ROOT')) {
     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();
index fc4de5b5ef44b64136ef26e851180d69a667c4a6..5a630a13bfb06be25f36cf926dbd7a3f6fd01bbb 100644 (file)
@@ -1,24 +1,28 @@
 <!--
   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>
index 1c65d9317d4a1fe1a9d6c877afeb34c9d4ed16fd..1504d5a8fab0a6ad2ed34e747e17c02435db7a90 100644 (file)
@@ -48,6 +48,7 @@ class TestListener extends \PHPUnit_Util_Printer implements \PHPUnit_Framework_T
 
     // Array of incomplete tests.
     private $incomplete = array();
+    private $risky = array();
 
     // An error occurred.
     public function addError(\PHPUnit_Framework_Test $test,
@@ -70,7 +71,7 @@ class TestListener extends \PHPUnit_Util_Printer implements \PHPUnit_Framework_T
         $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());
@@ -81,6 +82,14 @@ class TestListener extends \PHPUnit_Util_Printer implements \PHPUnit_Framework_T
         $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)