Skip to content

Commit

Permalink
- Merge [3977] and [3978].
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Nov 8, 2008
1 parent 5c67c5a commit d838f3c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 22 deletions.
12 changes: 2 additions & 10 deletions PHPUnit/TextUI/Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,7 @@ public static function main($exit = TRUE)
require_once 'PHPUnit/Util/Skeleton/Test.php';

if (isset($arguments['bootstrap'])) {
$bootstrapFile = PHPUnit_Util_Filesystem::fileExistsInIncludePath($arguments['bootstrap']);

if ($bootstrapFile) {
require_once $bootstrapFile;
}
PHPUnit_Util_Fileloader::load($arguments['bootstrap']);
}

$skeleton = new PHPUnit_Util_Skeleton_Test(
Expand Down Expand Up @@ -448,11 +444,7 @@ protected static function handleArguments()
PHPUnit_TextUI_TestRunner::printVersionString();

if (isset($arguments['bootstrap'])) {
$bootstrapFile = PHPUnit_Util_Filesystem::fileExistsInIncludePath($arguments['bootstrap']);

if ($bootstrapFile) {
require_once $bootstrapFile;
}
PHPUnit_Util_Fileloader::load($arguments['bootstrap']);
}

if ($option[0] == '--skeleton-class') {
Expand Down
6 changes: 1 addition & 5 deletions PHPUnit/TextUI/TestRunner.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,7 @@ public function doRun(PHPUnit_Framework_Test $suite, array $arguments = array())
$this->handleConfiguration($arguments);

if (isset($arguments['bootstrap'])) {
$bootstrapFile = PHPUnit_Util_Filesystem::fileExistsInIncludePath($arguments['bootstrap']);

if ($bootstrapFile) {
require_once $bootstrapFile;
}
PHPUnit_Util_Fileloader::load($arguments['bootstrap']);
}

if (is_integer($arguments['repeat'])) {
Expand Down
19 changes: 12 additions & 7 deletions PHPUnit/Util/Fileloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
*/

require_once 'PHPUnit/Util/Filter.php';
require_once 'PHPUnit/Util/Filesystem.php';

PHPUnit_Util_Filter::addFileToFilter(__FILE__, 'PHPUNIT');

Expand Down Expand Up @@ -109,16 +110,20 @@ public static function checkAndLoad($filename, $syntaxCheck = TRUE)
*/
protected static function load($filename)
{
$oldVariableNames = array_keys(get_defined_vars());
$filename = PHPUnit_Util_Filesystem::fileExistsInIncludePath($filename);

include_once $filename;
if ($filename) {
$oldVariableNames = array_keys(get_defined_vars());

$newVariables = get_defined_vars();
$newVariableNames = array_diff(array_keys($newVariables), $oldVariableNames);
include_once $filename;

foreach ($newVariableNames as $variableName) {
if ($variableName != 'oldVariableNames') {
$GLOBALS[$variableName] = $newVariables[$variableName];
$newVariables = get_defined_vars();
$newVariableNames = array_diff(array_keys($newVariables), $oldVariableNames);

foreach ($newVariableNames as $variableName) {
if ($variableName != 'oldVariableNames') {
$GLOBALS[$variableName] = $newVariables[$variableName];
}
}
}
}
Expand Down

0 comments on commit d838f3c

Please sign in to comment.