mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Added code so that the system doesn't break when PHPUnit isn't installed.
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@40164 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
06b8220c91
commit
e6ed1b3dd5
@ -27,6 +27,17 @@ if(ManifestBuilder::staleManifest()) ManifestBuilder::compileManifest();
|
|||||||
|
|
||||||
require_once(MANIFEST_FILE);
|
require_once(MANIFEST_FILE);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
// Check that PHPUnit is installed
|
||||||
|
$hasPhpUnit = false;
|
||||||
|
$paths = explode(PATH_SEPARATOR, ini_get('include_path'));
|
||||||
|
foreach($paths as $path) {
|
||||||
|
if(file_exists("$path/PHPUnit/Framework.php")) $hasPhpUnit = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($hasPhpUnit) {
|
||||||
|
|
||||||
require_once 'PHPUnit/Framework.php';
|
require_once 'PHPUnit/Framework.php';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -124,4 +135,9 @@ class SapphireTest extends PHPUnit_Framework_TestCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// Stub
|
||||||
|
class SapphireTest extends Object {}
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
@ -1,5 +1,14 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
// Check that PHPUnit is installed
|
||||||
|
$hasPhpUnit = false;
|
||||||
|
$paths = explode(PATH_SEPARATOR, ini_get('include_path'));
|
||||||
|
foreach($paths as $path) {
|
||||||
|
if(file_exists("$path/PHPUnit/Framework.php")) $hasPhpUnit = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($hasPhpUnit) {
|
||||||
|
|
||||||
require_once 'PHPUnit/Framework.php';
|
require_once 'PHPUnit/Framework.php';
|
||||||
require_once 'PHPUnit/TextUI/TestRunner.php';
|
require_once 'PHPUnit/TextUI/TestRunner.php';
|
||||||
|
|
||||||
@ -22,6 +31,16 @@ class TestRunner extends Controller {
|
|||||||
$suite->addTest(new PHPUnit_Framework_TestSuite($test));
|
$suite->addTest(new PHPUnit_Framework_TestSuite($test));
|
||||||
}
|
}
|
||||||
|
|
||||||
PHPUnit_TextUI_TestRunner::run($suite);
|
PHPUnit_TextUI_TestRunner::run($suite/*, array("reportDirectory" => "/Users/sminnee/phpunit-report")*/);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
class TestRunner extends Controller {
|
||||||
|
function index() {
|
||||||
|
echo "Please install PHPUnit using pear.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user