I get the mentioned error when trying to run form Drush command line

Comments

andreiashu’s picture

Status: Needs work » Active

Committed a fix here.
I just realised that we kinda need a dev branch...

andreiashu’s picture

Version: 6.x-0.5-beta1 » 6.x-1.x-dev
Assigned: Unassigned » andreiashu
Status: Active » Fixed

This has been committed to both HEAD and 6.x-1.x.

andreiashu’s picture

Forgot to add, my PHPUnit version says: "PHPUnit 3.4.15 by Sebastian Bergmann."

andreiashu’s picture

Status: Fixed » Needs work

I just realised that this might not be as simple as I thought initially. I suppose that the function that we have in drunit.drush.inc needs to be moved in the main module file so that we can use it not only in drush:


function drush_drunit_include_files() {
  // include PHPUnit files
  require_once 'PHPUnit/Runner/Version.php';
  $phpunit_version = explode('.', PHPUnit_Runner_Version::id());
  if ($phpunit_version[0] < 3) {
    drush_print('Your version of PHPUnit is outdated. Detected version: '. implode('.', $phpunit_version));
  }

  // PHPUnit >= 3.5
  if ($phpunit_version[1] >= 5) {
    require_once 'PHPUnit/Autoload.php';
  }
  else {
    require_once 'PHPUnit/Framework.php';
    require_once 'PHPUnit/TextUI/TestRunner.php';
    require_once 'PHPUnit/Extensions/SeleniumTestCase.php';
  }

  // include Drunit files
  $base_dir = realpath(dirname(__FILE__));
  require_once $base_dir . '/DrunitTestListener.inc';
  require_once $base_dir . '/Framework/TestCase.php';
  require_once $base_dir . '/Extensions/SeleniumTestCase.php';
}

For me the commit in #1 works but I only tested with drush. Can anyone else confirm if it is working for them in a standard setup (as in running phpunit command directly)?