aboutsummaryrefslogtreecommitdiffstats
path: root/tests/cron/task_provider_test.php
blob: 4547c61a553ffa6d737c127e5649925434e39957 (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
<?php
/**
*
* @package testing
* @copyright (c) 2010 phpBB Group
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/

require_once dirname(__FILE__) . '/../mock/extension_manager.php';

class phpbb_cron_task_provider_test extends PHPUnit_Framework_TestCase
{
	public function setUp()
	{
		$this->extension_manager = new phpbb_mock_extension_manager(
			dirname(__FILE__) . '/',
			array(
				'testext' => array(
					'ext_name'      => 'testext',
					'ext_active'    => true,
					'ext_path'      => 'ext/testext/'
				),
			));
		$this->provider = new phpbb_cron_task_provider($this->extension_manager);
	}

	public function test_manager_finds_shipped_tasks()
	{
		$tasks = array();
		foreach ($this->provider as $task)
		{
			$tasks[] = $task;
		}
		sort($tasks);

		$this->assertEquals(array(
			'phpbb_cron_task_core_dummy_task',
			'phpbb_cron_task_core_second_dummy_task',
			'phpbb_ext_testext_cron_dummy_task',
		), $tasks);
	}
}