aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephannos <barouxe@phelma.grenoble-inp.fr>2014-06-02 16:25:19 +0200
committerStephannos <barouxe@phelma.grenoble-inp.fr>2014-06-02 16:25:19 +0200
commit71fb956498ec882573205a0a074350372f528020 (patch)
tree0b7da89d8b48bd9e7c39a7c9a1f7d3f5f076fae7
parent85e8d1c2efd5f3746ebd50c91ba9e95a98ecb28c (diff)
parentc3ccef10d191c9d6ff5d655074a2a0b436788bcd (diff)
downloadforums-71fb956498ec882573205a0a074350372f528020.tar
forums-71fb956498ec882573205a0a074350372f528020.tar.gz
forums-71fb956498ec882573205a0a074350372f528020.tar.bz2
forums-71fb956498ec882573205a0a074350372f528020.tar.xz
forums-71fb956498ec882573205a0a074350372f528020.zip
Merge pull request #3 from Nicofuma/Stephannos-ticket/12602
[ticket/12602] Cleanup tests
-rw-r--r--tests/console/cron/cron_list_test.php16
-rw-r--r--tests/console/cron/tasks/simple_not_runnable.php18
-rw-r--r--tests/console/cron/tasks/simple_ready.php7
-rw-r--r--tests/console/cron/tasks/simple_should_not_run.php18
4 files changed, 9 insertions, 50 deletions
diff --git a/tests/console/cron/cron_list_test.php b/tests/console/cron/cron_list_test.php
index 12fac4a832..aabd3e388a 100644
--- a/tests/console/cron/cron_list_test.php
+++ b/tests/console/cron/cron_list_test.php
@@ -7,7 +7,7 @@
*
*/
-require_once dirname(__FILE__) . '/tasks/simple.php';
+require_once dirname(__FILE__) . '/tasks/simple_ready.php';
require_once dirname(__FILE__) . '/tasks/simple_not_ready.php';
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Tester\CommandTester;
@@ -41,13 +41,13 @@ class phpbb_console_command_cron_list_test extends phpbb_test_case
public function test_only_ready()
{
$tasks = array(
- new phpbb_cron_task_simple(),
- new phpbb_cron_task_simple()
+ new phpbb_cron_task_simple_ready(),
+ new phpbb_cron_task_simple_ready()
);
$this->get_cron_manager($tasks);
$command_tester = $this->get_command_tester();
$command_tester->execute(array('command' => $this->command_name, '--no-ansi' => true));
- $this->assertContains('TASKS_READYcommand1command2', preg_replace('/\s+/', '', $command_tester->getDisplay()));
+ $this->assertContains('TASKS_READY command1 command2', preg_replace('/\s+/', ' ', trim($command_tester->getDisplay())));
}
public function test_only_not_ready()
@@ -59,21 +59,21 @@ class phpbb_console_command_cron_list_test extends phpbb_test_case
$this->get_cron_manager($tasks);
$command_tester = $this->get_command_tester();
$command_tester->execute(array('command' => $this->command_name, '--no-ansi' => true));
- $this->assertContains('TASKS_NOT_READYcommand1command2', preg_replace('/\s+/', '', $command_tester->getDisplay()));
+ $this->assertContains('TASKS_NOT_READY command1 command2', preg_replace('/\s+/', ' ', trim($command_tester->getDisplay())));
}
public function test_both_ready()
{
$tasks = array(
- new phpbb_cron_task_simple(),
- new phpbb_cron_task_simple(),
+ new phpbb_cron_task_simple_ready(),
+ new phpbb_cron_task_simple_ready(),
new phpbb_cron_task_simple_not_ready(),
new phpbb_cron_task_simple_not_ready()
);
$this->get_cron_manager($tasks);
$command_tester = $this->get_command_tester();
$command_tester->execute(array('command' => $this->command_name, '--no-ansi' => true));
- $this->assertSame('TASKS_READYcommand1command2TASKS_NOT_READYcommand3command4', preg_replace('/\s+/', '', $command_tester->getDisplay()));
+ $this->assertSame('TASKS_READY command1 command2 TASKS_NOT_READY command3 command4', preg_replace('/\s+/', ' ', trim($command_tester->getDisplay())));
}
public function get_cron_manager(array $tasks)
diff --git a/tests/console/cron/tasks/simple_not_runnable.php b/tests/console/cron/tasks/simple_not_runnable.php
deleted file mode 100644
index 4951b5b4b9..0000000000
--- a/tests/console/cron/tasks/simple_not_runnable.php
+++ /dev/null
@@ -1,18 +0,0 @@
-<?php
-
-class phpbb_cron_task_core_simple_not_runnable extends \phpbb\cron\task\base
-{
- public function get_name()
- {
- return get_class($this);
- }
-
- public function run()
- {
- }
-
- public function is_runnable()
- {
- return false;
- }
-}
diff --git a/tests/console/cron/tasks/simple_ready.php b/tests/console/cron/tasks/simple_ready.php
index 245d9ba738..47970e104f 100644
--- a/tests/console/cron/tasks/simple_ready.php
+++ b/tests/console/cron/tasks/simple_ready.php
@@ -1,12 +1,7 @@
<?php
-class phpbb_cron_task_core_simple_ready extends \phpbb\cron\task\base
+class phpbb_cron_task_simple_ready extends \phpbb\cron\task\base
{
- public function get_name()
- {
- return get_class($this);
- }
-
public function run()
{
}
diff --git a/tests/console/cron/tasks/simple_should_not_run.php b/tests/console/cron/tasks/simple_should_not_run.php
deleted file mode 100644
index 7bd9df31b6..0000000000
--- a/tests/console/cron/tasks/simple_should_not_run.php
+++ /dev/null
@@ -1,18 +0,0 @@
-<?php
-
-class phpbb_cron_task_core_simple_should_not_run extends \phpbb\cron\task\base
-{
- public function get_name()
- {
- return get_class($this);
- }
-
- public function run()
- {
- }
-
- public function should_run()
- {
- return false;
- }
-}