mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
API CHANGE: Replaced ManifestBuilder::load_test_manifest() calls with new function TestRunner::use_test_manifest(), which pushes a test manifest onto the class loader.
This commit is contained in:
parent
184da5bbcc
commit
0c78935db4
@ -87,7 +87,7 @@ class CodeViewer extends Controller {
|
|||||||
parent::init();
|
parent::init();
|
||||||
|
|
||||||
if(!Permission::check('ADMIN')) return Security::permissionFailure();
|
if(!Permission::check('ADMIN')) return Security::permissionFailure();
|
||||||
ManifestBuilder::load_test_manifest();
|
TestRunner::use_test_manifest();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function browse() {
|
public function browse() {
|
||||||
|
@ -79,7 +79,17 @@ class TestRunner extends Controller {
|
|||||||
if (is_string($reporter)) $reporter = new $reporter;
|
if (is_string($reporter)) $reporter = new $reporter;
|
||||||
self::$default_reporter = $reporter;
|
self::$default_reporter = $reporter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pushes a class manifest instance that uses tests onto the top of the
|
||||||
|
* autoloader stack.
|
||||||
|
*/
|
||||||
|
public static function use_test_manifest() {
|
||||||
|
SS_ClassLoader::instance()->pushManifest(new SS_ClassManifest(
|
||||||
|
BASE_PATH, true, isset($_GET['flush'])
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
parent::init();
|
parent::init();
|
||||||
|
|
||||||
@ -102,7 +112,7 @@ class TestRunner extends Controller {
|
|||||||
* Currently excludes PhpSyntaxTest
|
* Currently excludes PhpSyntaxTest
|
||||||
*/
|
*/
|
||||||
function all($request, $coverage = false) {
|
function all($request, $coverage = false) {
|
||||||
ManifestBuilder::load_test_manifest();
|
self::use_test_manifest();
|
||||||
$tests = ClassInfo::subclassesFor('SapphireTest');
|
$tests = ClassInfo::subclassesFor('SapphireTest');
|
||||||
array_shift($tests);
|
array_shift($tests);
|
||||||
unset($tests['FunctionalTest']);
|
unset($tests['FunctionalTest']);
|
||||||
@ -122,7 +132,7 @@ class TestRunner extends Controller {
|
|||||||
* Run test classes that should be run before build - i.e., everything possible.
|
* Run test classes that should be run before build - i.e., everything possible.
|
||||||
*/
|
*/
|
||||||
function build() {
|
function build() {
|
||||||
ManifestBuilder::load_test_manifest();
|
self::use_test_manifest();
|
||||||
$tests = ClassInfo::subclassesFor('SapphireTest');
|
$tests = ClassInfo::subclassesFor('SapphireTest');
|
||||||
array_shift($tests);
|
array_shift($tests);
|
||||||
unset($tests['FunctionalTest']);
|
unset($tests['FunctionalTest']);
|
||||||
@ -138,7 +148,7 @@ class TestRunner extends Controller {
|
|||||||
* Browse all enabled test cases in the environment
|
* Browse all enabled test cases in the environment
|
||||||
*/
|
*/
|
||||||
function browse() {
|
function browse() {
|
||||||
ManifestBuilder::load_test_manifest();
|
self::use_test_manifest();
|
||||||
self::$default_reporter->writeHeader();
|
self::$default_reporter->writeHeader();
|
||||||
self::$default_reporter->writeInfo('Available Tests', false);
|
self::$default_reporter->writeInfo('Available Tests', false);
|
||||||
if(Director::is_cli()) {
|
if(Director::is_cli()) {
|
||||||
@ -170,7 +180,7 @@ class TestRunner extends Controller {
|
|||||||
* Run a coverage test across all modules
|
* Run a coverage test across all modules
|
||||||
*/
|
*/
|
||||||
function coverageAll($request) {
|
function coverageAll($request) {
|
||||||
ManifestBuilder::load_all_classes();
|
self::use_test_manifest();
|
||||||
$this->all($request, true);
|
$this->all($request, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -197,7 +207,7 @@ class TestRunner extends Controller {
|
|||||||
* Run only a single test class or a comma-separated list of tests
|
* Run only a single test class or a comma-separated list of tests
|
||||||
*/
|
*/
|
||||||
function only($request, $coverage = false) {
|
function only($request, $coverage = false) {
|
||||||
ManifestBuilder::load_test_manifest();
|
self::use_test_manifest();
|
||||||
if($request->param('TestCase') == 'all') {
|
if($request->param('TestCase') == 'all') {
|
||||||
$this->all();
|
$this->all();
|
||||||
} else {
|
} else {
|
||||||
@ -217,7 +227,7 @@ class TestRunner extends Controller {
|
|||||||
* A module is generally a toplevel folder, e.g. "mysite" or "sapphire".
|
* A module is generally a toplevel folder, e.g. "mysite" or "sapphire".
|
||||||
*/
|
*/
|
||||||
function module($request, $coverage = false) {
|
function module($request, $coverage = false) {
|
||||||
ManifestBuilder::load_test_manifest();
|
self::use_test_manifest();
|
||||||
$classNames = array();
|
$classNames = array();
|
||||||
$moduleNames = explode(',', $request->param('ModuleName'));
|
$moduleNames = explode(',', $request->param('ModuleName'));
|
||||||
foreach($moduleNames as $moduleName) {
|
foreach($moduleNames as $moduleName) {
|
||||||
|
@ -47,7 +47,7 @@ class FullTestSuite {
|
|||||||
* @return Array
|
* @return Array
|
||||||
*/
|
*/
|
||||||
public static function get_all_tests() {
|
public static function get_all_tests() {
|
||||||
ManifestBuilder::load_test_manifest();
|
TestRunner::use_test_manifest();
|
||||||
$tests = ClassInfo::subclassesFor('SapphireTest');
|
$tests = ClassInfo::subclassesFor('SapphireTest');
|
||||||
array_shift($tests);
|
array_shift($tests);
|
||||||
|
|
||||||
|
2
tests/bootstrap.php
Executable file → Normal file
2
tests/bootstrap.php
Executable file → Normal file
@ -32,4 +32,4 @@ if(!class_exists('Object')) {
|
|||||||
|
|
||||||
$_SERVER['REQUEST_URI'] = BASE_URL . '/dev';
|
$_SERVER['REQUEST_URI'] = BASE_URL . '/dev';
|
||||||
|
|
||||||
ManifestBuilder::load_test_manifest();
|
TestRunner::use_test_manifest();
|
Loading…
Reference in New Issue
Block a user