aboutsummaryrefslogtreecommitdiffstats
path: root/tests/cron/manager_test.php
blob: dcb3c6435a5d3c7abe4b9d46362676bad454989b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
/**
*
* @package testing
* @copyright (c) 2010 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/

class phpbb_cron_manager_test extends PHPUnit_Framework_TestCase
{
	public function setUp()
	{
		$this->manager = new phpbb_cron_manager();
	}

	public function test_manager_finds_shipped_tasks()
	{
		$tasks = $this->manager->find_cron_task_names();
		$this->assertGreaterThan(1, count($tasks));
	}

	public function test_manager_finds_shipped_task_by_name()
	{
		$task = $this->manager->find_task('phpbb_cron_task_core_queue');
		$this->assertNotNull($task);
	}

	public function test_manager_instantiates_task_by_name()
	{
		$task = $this->manager->instantiate_task('phpbb_cron_task_core_queue', array());
		$this->assertNotNull($task);
	}

	public function test_manager_finds_all_ready_tasks()
	{
		$tasks = $this->manager->find_all_ready_tasks();
		$this->assertGreaterThan(0, count($tasks));
	}

	public function test_manager_finds_one_ready_task()
	{
		$task = $this->manager->find_one_ready_task();
		$this->assertNotNull($task);
	}
}