mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
ENHANCEMENT: Added FullTestSuite.php, so that you can test by running "phpunit sapphire/tests/FullTestSuite". (from r111045)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112883 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
67b5116702
commit
2e91384e72
43
tests/FullTestSuite.php
Normal file
43
tests/FullTestSuite.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
|
||||
if(!class_exists('Object')) {
|
||||
require_once("sapphire/core/Core.php");
|
||||
global $databaseConfig;
|
||||
DB::connect($databaseConfig);
|
||||
}
|
||||
|
||||
//$c = new Controller;
|
||||
//$c->pushCurrent();
|
||||
|
||||
class FullTestSuite {
|
||||
public static function get_tests() {
|
||||
ManifestBuilder::load_test_manifest();
|
||||
$tests = ClassInfo::subclassesFor('SapphireTest');
|
||||
array_shift($tests);
|
||||
unset($tests['FunctionalTest']);
|
||||
|
||||
// Remove tests that don't need to be executed every time
|
||||
unset($tests['PhpSyntaxTest']);
|
||||
|
||||
foreach($tests as $class => $v) {
|
||||
$reflection = new ReflectionClass($class);
|
||||
if (!$reflection->isInstantiable()) {
|
||||
unset($tests[$class]);
|
||||
}
|
||||
}
|
||||
return $tests;
|
||||
}
|
||||
|
||||
public static function suite()
|
||||
{
|
||||
$suite = new PHPUnit_Framework_TestSuite();
|
||||
$classList = self::get_tests();
|
||||
foreach($classList as $className) {
|
||||
$suite->addTest(new SapphireTestSuite($className));
|
||||
}
|
||||
|
||||
return $suite;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user