mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 04:18:52 +00:00
[feature/system-cron] Move tests to phpunit.xml and always load class loader
PHPBB3-9596
This commit is contained in:
parent
4fbf3fbd40
commit
6e5e4721d8
3 changed files with 12 additions and 59 deletions
|
@ -31,6 +31,11 @@ require_once $phpbb_root_path . 'includes/class_loader.' . $phpEx;
|
||||||
$class_loader = new phpbb_class_loader($phpbb_root_path, '.php');
|
$class_loader = new phpbb_class_loader($phpbb_root_path, '.php');
|
||||||
$class_loader->register();
|
$class_loader->register();
|
||||||
|
|
||||||
|
require $phpbb_root_path . 'includes/class_loader.php';
|
||||||
|
|
||||||
|
$class_loader = new phpbb_class_loader($phpbb_root_path, '.php');
|
||||||
|
$class_loader->register();
|
||||||
|
|
||||||
require_once 'test_framework/phpbb_test_case_helpers.php';
|
require_once 'test_framework/phpbb_test_case_helpers.php';
|
||||||
require_once 'test_framework/phpbb_test_case.php';
|
require_once 'test_framework/phpbb_test_case.php';
|
||||||
require_once 'test_framework/phpbb_database_test_case.php';
|
require_once 'test_framework/phpbb_database_test_case.php';
|
||||||
|
|
|
@ -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();
|
|
||||||
}
|
|
||||||
|
|
|
@ -7,18 +7,6 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
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
|
class phpbb_cron_manager_test extends PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
public function setUp()
|
public function setUp()
|
||||||
|
@ -50,7 +38,8 @@ class phpbb_cron_manager_test extends PHPUnit_Framework_TestCase
|
||||||
$this->assertGreaterThan(0, count($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();
|
$task = $this->manager->find_one_ready_task();
|
||||||
$this->assertNotNull($task);
|
$this->assertNotNull($task);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue