BUGFIX: prevent TestRunner from dying when running through sake and loading FullTestSuite

This commit is contained in:
Will Rossiter 2011-09-26 16:08:31 +13:00
parent 6564fafa21
commit 60ea09bb42

View File

@ -1,6 +1,4 @@
<?php <?php
@require_once('sapphire/tests/bootstrap.php');
/** /**
* Alternative to letting PHPUnit handle class retrieval via * Alternative to letting PHPUnit handle class retrieval via
* traversing the filesystem. Works around restrictions of PHPUnit * traversing the filesystem. Works around restrictions of PHPUnit
@ -29,6 +27,8 @@ class FullTestSuite {
* @return PHPUnit_Framework_TestSuite * @return PHPUnit_Framework_TestSuite
*/ */
public static function suite() { public static function suite() {
require_once('sapphire/tests/bootstrap.php');
$suite = new PHPUnit_Framework_TestSuite(); $suite = new PHPUnit_Framework_TestSuite();
if(isset($_GET['module'])) { if(isset($_GET['module'])) {
$classList = self::get_module_tests($_GET['module']); $classList = self::get_module_tests($_GET['module']);
@ -47,6 +47,8 @@ class FullTestSuite {
* @return Array * @return Array
*/ */
public static function get_all_tests() { public static function get_all_tests() {
require_once('sapphire/tests/bootstrap.php');
TestRunner::use_test_manifest(); TestRunner::use_test_manifest();
$tests = ClassInfo::subclassesFor('SapphireTest'); $tests = ClassInfo::subclassesFor('SapphireTest');
array_shift($tests); array_shift($tests);
@ -62,6 +64,8 @@ class FullTestSuite {
* @return Array * @return Array
*/ */
protected static function get_module_tests($namesStr) { protected static function get_module_tests($namesStr) {
require_once('sapphire/tests/bootstrap.php');
$tests = array(); $tests = array();
$names = explode(',', $namesStr); $names = explode(',', $namesStr);
foreach($names as $name) { foreach($names as $name) {