scripts/phpunit-{ls,indiv} - Fixes for standalone PHPUnit
authorTim Otten <totten@civicrm.org>
Thu, 31 Mar 2016 21:51:06 +0000 (14:51 -0700)
committerTim Otten <totten@civicrm.org>
Thu, 31 Mar 2016 21:51:06 +0000 (14:51 -0700)
tools/scripts/phpunit-indiv
tools/scripts/phpunit-ls

index c681c56be4199e793b884887ef3e189a26ff048d..8dc447c5336c91ee708d385a535fd5edd5a0ba76 100755 (executable)
@@ -54,6 +54,8 @@ fi
 
 #phpunit-ls "$TESTSUITE"
 $BINDIR/phpunit-ls "$TESTSUITE" | while read FILE CLASS METHOD ; do
+  if [ -z "$FILE" -o ! -f "$FILE" ]; then continue; fi
+  echo "[[Processing $FILE $CLASS::$METHOD]]"
   ## Optionally reset DBs
   if [ -n "$CIVIBUILD_RESTORE" ]; then
     civibuild restore "$CIVIBUILD_RESTORE"
index 6d6ffc2076dc7a460351b98629e68d162da81fa4..cc617906a8fd8516717b87cd3055ffb2ae5aca7f 100755 (executable)
@@ -1,5 +1,17 @@
 #!/usr/bin/env php
 <?php
+
 require_once dirname(dirname(__DIR__)) . '/tests/phpunit/CiviTest/bootstrap.php';
 error_reporting(E_ALL);
+
+if (!class_exists('PHPUnit_Framework_TestCase')) {
+  // Oooph.  PHPUnit isn't available, and we don't really need its services,
+  // but the scanner will try to read metadata about our test-classes, and
+  // that requires having the parent-classes defined.
+
+  class PHPUnit_Framework_TestCase {}
+  class PHPUnit_Extensions_Database_TestCase {}
+  class PHPUnit_Extensions_SeleniumTestCase {}
+}
+
 \Civi\CiUtil\Command\LsCommand::main($argv);
\ No newline at end of file