aboutsummaryrefslogtreecommitdiffstats
path: root/tests/console/cron
diff options
context:
space:
mode:
authorLEZY Thomas <thomas.gif.91@gmail.com>2014-05-28 19:51:59 +0200
committerLEZY Thomas <thomas.gif.91@gmail.com>2014-05-28 20:03:28 +0200
commit9f942776ad5a3b396045e6f97db6ef655c5d9fcc (patch)
tree65e6d021e94dd4c66696f4b3727bf5e481e195d8 /tests/console/cron
parent61ad42790f653c0fe7bf1c1b5d27181794bec997 (diff)
downloadforums-9f942776ad5a3b396045e6f97db6ef655c5d9fcc.tar
forums-9f942776ad5a3b396045e6f97db6ef655c5d9fcc.tar.gz
forums-9f942776ad5a3b396045e6f97db6ef655c5d9fcc.tar.bz2
forums-9f942776ad5a3b396045e6f97db6ef655c5d9fcc.tar.xz
forums-9f942776ad5a3b396045e6f97db6ef655c5d9fcc.zip
[ticket/12597] Changes name of command cron:run-all to cron:run.
Also adds an optional argument to specify one precise cron task to lauch, and modifies test file accordingly. PHPBB3-12597
Diffstat (limited to 'tests/console/cron')
-rw-r--r--tests/console/cron/run_test.php (renamed from tests/console/cron/run_all_test.php)35
1 files changed, 31 insertions, 4 deletions
diff --git a/tests/console/cron/run_all_test.php b/tests/console/cron/run_test.php
index 716ad50d81..c7c514c084 100644
--- a/tests/console/cron/run_all_test.php
+++ b/tests/console/cron/run_test.php
@@ -13,11 +13,11 @@
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Tester\CommandTester;
-use phpbb\console\command\cron\run_all;
+use phpbb\console\command\cron\run;
require_once dirname(__FILE__) . '/tasks/simple.php';
-class phpbb_console_command_cron_run_all_test extends phpbb_database_test_case
+class phpbb_console_command_cron_run_test extends phpbb_database_test_case
{
protected $db;
protected $config;
@@ -81,12 +81,39 @@ class phpbb_console_command_cron_run_all_test extends phpbb_database_test_case
$this->assertSame(false, $this->task->executed);
}
+ public function test_arg_valid()
+ {
+ $command_tester = $this->get_command_tester();
+ $command_tester->execute(array('command' => $this->command_name, 'name' => 'phpbb_cron_task_simple'));
+
+ $this->assertSame('', $command_tester->getDisplay());
+ $this->assertSame(true, $this->task->executed);
+ }
+
+ public function test_arg_invalid()
+ {
+ $command_tester = $this->get_command_tester();
+ $command_tester->execute(array('command' => $this->command_name, 'name' => 'foo'));
+
+ $this->assertContains('CRON_NO_TASK', $command_tester->getDisplay());
+ $this->assertSame(false, $this->task->executed);
+ }
+
+ public function test_arg_valid_verbose()
+ {
+ $command_tester = $this->get_command_tester();
+ $command_tester->execute(array('command' => $this->command_name, 'name' => 'phpbb_cron_task_simple', '--verbose' => true));
+
+ $this->assertSame('', $command_tester->getDisplay());
+ $this->assertSame(true, $this->task->executed);
+ }
+
public function get_command_tester()
{
$application = new Application();
- $application->add(new run_all($this->cron_manager, $this->lock, $this->user));
+ $application->add(new run($this->cron_manager, $this->lock, $this->user));
- $command = $application->find('cron:run-all');
+ $command = $application->find('cron:run');
$this->command_name = $command->getName();
return new CommandTester($command);
}