silverstripe-framework/tests/dev/TaskRunnerTest.php
Damian Mooyman 8dd644d25d
API Namespace all classes
Namespace all templates
Move difflib and BBCodeParser2 to thirdparty
Remove deprecated API marked for removal in 4.0
2016-09-08 10:23:17 +12:00

60 lines
1.4 KiB
PHP

<?php
use SilverStripe\Dev\TaskRunner;
use SilverStripe\Dev\SapphireTest;
use SilverStripe\Dev\BuildTask;
/**
* @package framework
* @subpackage tests
*/
class TaskRunnerTest extends SapphireTest {
public function testTaskEnabled() {
$runner = new TaskRunner();
$method = new ReflectionMethod($runner, 'taskEnabled');
$method->setAccessible(true);
$this->assertTrue($method->invoke($runner, 'TaskRunnerTest_EnabledTask'),
'Enabled task incorrectly marked as disabled');
$this->assertFalse($method->invoke($runner, 'TaskRunnerTest_DisabledTask'),
'Disabled task incorrectly marked as enabled');
$this->assertFalse($method->invoke($runner, 'TaskRunnerTest_AbstractTask'),
'Disabled task incorrectly marked as enabled');
$this->assertTrue($method->invoke($runner, 'TaskRunnerTest_ChildOfAbstractTask'),
'Enabled task incorrectly marked as disabled');
}
}
class TaskRunnerTest_EnabledTask extends BuildTask {
protected $enabled = true;
public function run($request) {
// NOOP
}
}
class TaskRunnerTest_DisabledTask extends BuildTask {
protected $enabled = false;
public function run($request) {
// NOOP
}
}
abstract class TaskRunnerTest_AbstractTask extends BuildTask {
protected $enabled = true;
public function run($request) {
// NOOP
}
}
class TaskRunnerTest_ChildOfAbstractTask extends TaskRunnerTest_AbstractTask {
protected $enabled = true;
public function run($request) {
// NOOP
}
}