Skip to content

Commit b9ea952

Browse files
committed
Made sebastianbergmann#844 work for isolated tests.
1 parent 2799cef commit b9ea952

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

PHPUnit/Framework/Process/TestCaseMethod.tpl.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
ini_set('display_errors', 'stderr');
33
set_include_path('{include_path}');
4-
require 'PHPUnit/Autoload.php';
4+
require {autoload};
55
ob_start();
66

77
function __phpunit_run_isolated_test()

PHPUnit/Framework/TestCase.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -735,6 +735,12 @@ public function run(PHPUnit_Framework_TestResult $result = NULL)
735735
$strict = 'FALSE';
736736
}
737737

738+
if (defined('PHPUNIT_COMPOSER_INSTALL')) {
739+
$autoload = var_export(PHPUNIT_COMPOSER_INSTALL, TRUE);
740+
} else {
741+
$autoload = '\'PHPUnit/Autoload.php\'';
742+
}
743+
738744
$data = var_export(serialize($this->data), TRUE);
739745
$dependencyInput = var_export(serialize($this->dependencyInput), TRUE);
740746
$includePath = var_export(get_include_path(), TRUE);
@@ -746,6 +752,7 @@ public function run(PHPUnit_Framework_TestResult $result = NULL)
746752

747753
$template->setVar(
748754
array(
755+
'autoload' => $autoload,
749756
'filename' => $class->getFileName(),
750757
'className' => $class->getName(),
751758
'methodName' => $this->name,

composer/bin/phpunit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ foreach ($files as $file) {
4646
if (file_exists($file)) {
4747
require $file;
4848

49-
define('PHPUNIT_COMPOSER_INSTALL', TRUE);
49+
define('PHPUNIT_COMPOSER_INSTALL', $file);
5050

5151
break;
5252
}

0 commit comments

Comments
 (0)