diff options
author | LEZY Thomas <thomas.gif.91@gmail.com> | 2014-05-28 18:02:30 +0200 |
---|---|---|
committer | LEZY Thomas <thomas.gif.91@gmail.com> | 2014-05-28 18:02:30 +0200 |
commit | 0d839cbefc19247fd2b4c1132b91083bf0983305 (patch) | |
tree | 3f283bb435694940d52710e4aad568463239b600 /tests/console/cron | |
parent | 5fca30813809c4fbbcad0ffc12903eda6279b88b (diff) | |
download | forums-0d839cbefc19247fd2b4c1132b91083bf0983305.tar forums-0d839cbefc19247fd2b4c1132b91083bf0983305.tar.gz forums-0d839cbefc19247fd2b4c1132b91083bf0983305.tar.bz2 forums-0d839cbefc19247fd2b4c1132b91083bf0983305.tar.xz forums-0d839cbefc19247fd2b4c1132b91083bf0983305.zip |
[ticket/12597] Modification of return statuses and of test files
PHPBB3-12597
Diffstat (limited to 'tests/console/cron')
-rw-r--r-- | tests/console/cron/run_all_test.php | 10 | ||||
-rw-r--r-- | tests/console/cron/tasks/simple.php | 11 |
2 files changed, 15 insertions, 6 deletions
diff --git a/tests/console/cron/run_all_test.php b/tests/console/cron/run_all_test.php index b718d1c117..b85d5eb901 100644 --- a/tests/console/cron/run_all_test.php +++ b/tests/console/cron/run_all_test.php @@ -21,6 +21,7 @@ class phpbb_console_command_cron_run_all_test extends phpbb_database_test_case protected $user; protected $cron_manager; protected $command_name; + protected $task; public function getDataSet() { @@ -40,8 +41,9 @@ class phpbb_console_command_cron_run_all_test extends phpbb_database_test_case $this->user = $this->getMock('\phpbb\user'); $this->user->method('lang')->will($this->returnArgument(0)); + $this->task = new phpbb_cron_task_simple(); $tasks = array( - new phpbb_cron_task_simple(), + $this->task, ); $this->cron_manager = new \phpbb\cron\manager($tasks, $phpbb_root_path, $pathEx); @@ -58,7 +60,7 @@ class phpbb_console_command_cron_run_all_test extends phpbb_database_test_case $command_tester->execute(array('command' => $this->command_name)); $this->assertSame('', $command_tester->getDisplay()); - $this->assertSame(1, $cron_num_exec); + $this->assertSame(true, $this->task->executed); } public function test_verbose_mode() @@ -69,7 +71,7 @@ class phpbb_console_command_cron_run_all_test extends phpbb_database_test_case $command_tester->execute(array('command' => $this->command_name, '--verbose' => true)); $this->assertContains('RUNNING_TASK', $command_tester->getDisplay()); - $this->assertSame(1, $cron_num_exec); + $this->assertSame(true, $this->task->executed); } public function test_error_lock() @@ -81,7 +83,7 @@ class phpbb_console_command_cron_run_all_test extends phpbb_database_test_case $command_tester->execute(array('command' => $this->command_name)); $this->assertContains('CRON_LOCK_ERROR', $command_tester->getDisplay()); - $this->assertSame(0, $cron_num_exec); + $this->assertSame(false, $this->task->executed); } public function get_command_tester() diff --git a/tests/console/cron/tasks/simple.php b/tests/console/cron/tasks/simple.php index be2a8a1d9d..15194caaf7 100644 --- a/tests/console/cron/tasks/simple.php +++ b/tests/console/cron/tasks/simple.php @@ -2,6 +2,14 @@ class phpbb_cron_task_simple extends \phpbb\cron\task\base { + public $executed; + + public function __construct() + { + $executed = false; + parent::__construct(); + } + public function get_name() { return get_class($this); @@ -9,7 +17,6 @@ class phpbb_cron_task_simple extends \phpbb\cron\task\base public function run() { - global $cron_num_exec; - $cron_num_exec++; + $this->executed = true; } } |