From 520a5f92953d350880355dbe46217d2b41edd2bd Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Wed, 31 Aug 2011 17:49:48 -0400 Subject: [feature/extension-manager] Refactoring the structure of extension provider PHPBB3-10323 --- tests/cron/task_provider_test.php | 43 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 tests/cron/task_provider_test.php (limited to 'tests/cron/task_provider_test.php') diff --git a/tests/cron/task_provider_test.php b/tests/cron/task_provider_test.php new file mode 100644 index 0000000000..5565d0f64c --- /dev/null +++ b/tests/cron/task_provider_test.php @@ -0,0 +1,43 @@ +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); + } +} -- cgit v1.2.1 From 66c50f6b30400b729d3fea4fb06dad5eb559aa51 Mon Sep 17 00:00:00 2001 From: Unknown Date: Mon, 2 Jan 2012 17:14:00 +0000 Subject: [ticket/9916] Updating license in non-distributed files PHPBB3-9916 --- tests/cron/task_provider_test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/cron/task_provider_test.php') diff --git a/tests/cron/task_provider_test.php b/tests/cron/task_provider_test.php index 5565d0f64c..4547c61a55 100644 --- a/tests/cron/task_provider_test.php +++ b/tests/cron/task_provider_test.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ -- cgit v1.2.1 From 3ebe89cb7eff57c3ffdbe0b7dcd9cdc35b48d26b Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Mon, 9 Apr 2012 15:05:28 +0200 Subject: [feature/dic] Fix test suite for dic-powered cron PHPBB3-10739 --- tests/cron/task_provider_test.php | 41 +++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 15 deletions(-) (limited to 'tests/cron/task_provider_test.php') diff --git a/tests/cron/task_provider_test.php b/tests/cron/task_provider_test.php index 4547c61a55..4458d811a5 100644 --- a/tests/cron/task_provider_test.php +++ b/tests/cron/task_provider_test.php @@ -7,37 +7,48 @@ * */ -require_once dirname(__FILE__) . '/../mock/extension_manager.php'; +require_once dirname(__FILE__) . '/includes/cron/task/core/dummy_task.php'; +require_once dirname(__FILE__) . '/includes/cron/task/core/second_dummy_task.php'; +require_once dirname(__FILE__) . '/ext/testext/cron/dummy_task.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); + $this->tasks = array( + 'phpbb_cron_task_core_dummy_task', + 'phpbb_cron_task_core_second_dummy_task', + 'phpbb_ext_testext_cron_dummy_task', + ); + + $container = $this->getMock('Symfony\Component\DependencyInjection\TaggedContainerInterface'); + $container + ->expects($this->once()) + ->method('findTaggedServiceIds') + ->will($this->returnValue(array_flip($this->tasks))); + $container + ->expects($this->any()) + ->method('get') + ->will($this->returnCallback(function ($name) { + return new $name; + })); + + $this->provider = new phpbb_cron_task_provider($container); } public function test_manager_finds_shipped_tasks() { - $tasks = array(); + $task_names = array(); foreach ($this->provider as $task) { - $tasks[] = $task; + $task_names[] = $task->get_name(); } - sort($tasks); + sort($task_names); $this->assertEquals(array( 'phpbb_cron_task_core_dummy_task', 'phpbb_cron_task_core_second_dummy_task', 'phpbb_ext_testext_cron_dummy_task', - ), $tasks); + ), $task_names); } } -- cgit v1.2.1 From d3bbde69c441a5d795a16e66c9cc7a9194f42218 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sun, 8 Jul 2012 22:53:45 +0200 Subject: [ticket/10973] Drop all require_once for mocks. Use autoloading. PHPBB3-10973 --- tests/cron/task_provider_test.php | 2 -- 1 file changed, 2 deletions(-) (limited to 'tests/cron/task_provider_test.php') diff --git a/tests/cron/task_provider_test.php b/tests/cron/task_provider_test.php index 4547c61a55..b42f40bb4a 100644 --- a/tests/cron/task_provider_test.php +++ b/tests/cron/task_provider_test.php @@ -7,8 +7,6 @@ * */ -require_once dirname(__FILE__) . '/../mock/extension_manager.php'; - class phpbb_cron_task_provider_test extends PHPUnit_Framework_TestCase { public function setUp() -- cgit v1.2.1