aboutsummaryrefslogtreecommitdiffstats
path: root/tests/cron/manager_test.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/cron/manager_test.php')
-rw-r--r--tests/cron/manager_test.php32
1 files changed, 16 insertions, 16 deletions
diff --git a/tests/cron/manager_test.php b/tests/cron/manager_test.php
index f433fc9a9b..8ed33b06e2 100644
--- a/tests/cron/manager_test.php
+++ b/tests/cron/manager_test.php
@@ -19,10 +19,10 @@ class phpbb_cron_manager_test extends PHPUnit_Framework_TestCase
{
public function setUp()
{
- $this->manager = new phpbb_cron_manager(array(
- 'phpbb_cron_task_core_dummy_task',
- 'phpbb_cron_task_core_second_dummy_task',
- 'phpbb_ext_testext_cron_dummy_task',
+ $this->manager = $this->create_cron_manager(array(
+ new phpbb_cron_task_core_dummy_task(),
+ new phpbb_cron_task_core_second_dummy_task(),
+ new phpbb_ext_testext_cron_dummy_task(),
));
$this->task_name = 'phpbb_cron_task_core_dummy_task';
}
@@ -34,13 +34,6 @@ class phpbb_cron_manager_test extends PHPUnit_Framework_TestCase
$this->assertEquals($this->task_name, $task->get_name());
}
- public function test_manager_instantiates_task_by_name()
- {
- $task = $this->manager->instantiate_task($this->task_name, array());
- $this->assertInstanceOf('phpbb_cron_task_wrapper', $task);
- $this->assertEquals($this->task_name, $task->get_name());
- }
-
public function test_manager_finds_all_ready_tasks()
{
$tasks = $this->manager->find_all_ready_tasks();
@@ -55,10 +48,10 @@ class phpbb_cron_manager_test extends PHPUnit_Framework_TestCase
public function test_manager_finds_only_ready_tasks()
{
- $manager = new phpbb_cron_manager(array(
- 'phpbb_cron_task_core_simple_ready',
- 'phpbb_cron_task_core_simple_not_runnable',
- 'phpbb_cron_task_core_simple_should_not_run',
+ $manager = $this->create_cron_manager(array(
+ new phpbb_cron_task_core_simple_ready(),
+ new phpbb_cron_task_core_simple_not_runnable(),
+ new phpbb_cron_task_core_simple_should_not_run(),
));
$tasks = $manager->find_all_ready_tasks();
$task_names = $this->tasks_to_names($tasks);
@@ -70,8 +63,15 @@ class phpbb_cron_manager_test extends PHPUnit_Framework_TestCase
$names = array();
foreach ($tasks as $task)
{
- $names[] = get_class($task->task);
+ $names[] = $task->get_name();
}
return $names;
}
+
+ private function create_cron_manager($tasks)
+ {
+ global $phpbb_root_path, $phpEx;
+
+ return new phpbb_cron_manager($tasks, $phpbb_root_path, $phpEx);
+ }
}