2015-08-25 11:14:15 +02:00
|
|
|
<?php
|
2016-08-19 00:51:35 +02:00
|
|
|
|
2016-10-14 03:30:05 +02:00
|
|
|
namespace SilverStripe\Dev\Tests;
|
|
|
|
|
2016-08-19 00:51:35 +02:00
|
|
|
use SilverStripe\Dev\TaskRunner;
|
|
|
|
use SilverStripe\Dev\SapphireTest;
|
2016-10-14 03:30:05 +02:00
|
|
|
use ReflectionMethod;
|
|
|
|
|
2016-12-16 05:34:21 +01:00
|
|
|
class TaskRunnerTest extends SapphireTest
|
|
|
|
{
|
2015-08-25 11:14:15 +02:00
|
|
|
|
2016-12-16 05:34:21 +01:00
|
|
|
public function testTaskEnabled()
|
|
|
|
{
|
|
|
|
$runner = new TaskRunner();
|
|
|
|
$method = new ReflectionMethod($runner, 'taskEnabled');
|
|
|
|
$method->setAccessible(true);
|
2015-08-25 11:14:15 +02:00
|
|
|
|
2016-12-16 05:34:21 +01:00
|
|
|
$this->assertTrue(
|
|
|
|
$method->invoke($runner, TaskRunnerTest\TaskRunnerTest_EnabledTask::class),
|
|
|
|
'Enabled task incorrectly marked as disabled'
|
|
|
|
);
|
|
|
|
$this->assertFalse(
|
|
|
|
$method->invoke($runner, TaskRunnerTest\TaskRunnerTest_DisabledTask::class),
|
|
|
|
'Disabled task incorrectly marked as enabled'
|
|
|
|
);
|
|
|
|
$this->assertFalse(
|
|
|
|
$method->invoke($runner, TaskRunnerTest\TaskRunnerTest_AbstractTask::class),
|
|
|
|
'Disabled task incorrectly marked as enabled'
|
|
|
|
);
|
|
|
|
$this->assertTrue(
|
|
|
|
$method->invoke($runner, TaskRunnerTest\TaskRunnerTest_ChildOfAbstractTask::class),
|
|
|
|
'Enabled task incorrectly marked as disabled'
|
|
|
|
);
|
|
|
|
}
|
2015-08-25 11:14:15 +02:00
|
|
|
}
|