aboutsummaryrefslogtreecommitdiffstats
path: root/tests/cron
diff options
context:
space:
mode:
authorNils Adermann <naderman@naderman.de>2011-01-07 18:40:32 +0100
committerOleg Pudeyev <oleg@bsdpower.com>2011-02-12 22:05:53 -0500
commit6e5e4721d83c8bde9780b02bd011bdbf5d188dea (patch)
treea9413627ace96e0179e0dd85b5d2b3db83cb7eb4 /tests/cron
parent4fbf3fbd40ad7f6137526c4f36e8a932015a0c81 (diff)
downloadforums-6e5e4721d83c8bde9780b02bd011bdbf5d188dea.tar
forums-6e5e4721d83c8bde9780b02bd011bdbf5d188dea.tar.gz
forums-6e5e4721d83c8bde9780b02bd011bdbf5d188dea.tar.bz2
forums-6e5e4721d83c8bde9780b02bd011bdbf5d188dea.tar.xz
forums-6e5e4721d83c8bde9780b02bd011bdbf5d188dea.zip
[feature/system-cron] Move tests to phpunit.xml and always load class loader
PHPBB3-9596
Diffstat (limited to 'tests/cron')
-rw-r--r--tests/cron/all_tests.php41
-rw-r--r--tests/cron/manager_test.php25
2 files changed, 7 insertions, 59 deletions
diff --git a/tests/cron/all_tests.php b/tests/cron/all_tests.php
deleted file mode 100644
index 1fa5af7f5e..0000000000
--- a/tests/cron/all_tests.php
+++ /dev/null
@@ -1,41 +0,0 @@
-<?php
-/**
-*
-* @package testing
-* @copyright (c) 2010 phpBB Group
-* @license http://opensource.org/licenses/gpl-license.php GNU Public License
-*
-*/
-
-if (!defined('PHPUnit_MAIN_METHOD'))
-{
- define('PHPUnit_MAIN_METHOD', 'phpbb_cron_all_tests::main');
-}
-
-require_once 'test_framework/framework.php';
-require_once 'PHPUnit/TextUI/TestRunner.php';
-
-require_once 'cron/manager_test.php';
-
-class phpbb_cron_all_tests
-{
- public static function main()
- {
- PHPUnit_TextUI_TestRunner::run(self::suite());
- }
-
- public static function suite()
- {
- $suite = new PHPUnit_Framework_TestSuite('phpBB Cron');
-
- $suite->addTestSuite('phpbb_cron_manager_test');
-
- return $suite;
- }
-}
-
-if (PHPUnit_MAIN_METHOD == 'phpbb_cron_all_tests::main')
-{
- phpbb_cron_all_tests::main();
-}
-
diff --git a/tests/cron/manager_test.php b/tests/cron/manager_test.php
index 4d3fa1d120..dcb3c6435a 100644
--- a/tests/cron/manager_test.php
+++ b/tests/cron/manager_test.php
@@ -7,50 +7,39 @@
*
*/
-define('IN_PHPBB', true);
-
-require_once 'test_framework/framework.php';
-
-// need the class loader since cron does not include/require cron task files
-require($phpbb_root_path . 'includes/class_loader.' . $phpEx);
-// do not use cache
-$class_loader = new phpbb_class_loader($phpbb_root_path, '.' . $phpEx);
-$class_loader->register();
-
-require_once '../phpBB/includes/cron/manager.php';
-
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() {
+
+ public function test_manager_finds_one_ready_task()
+ {
$task = $this->manager->find_one_ready_task();
$this->assertNotNull($task);
}