1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-30 21:40:43 +02:00

[ticket/16549] Move from assert[Not]Contains to assertString[Not]ContainsString

PHPBB3-16549
This commit is contained in:
rxu
2020-07-13 13:45:12 +07:00
parent 16d8698e1b
commit 58ea656fd8
49 changed files with 291 additions and 280 deletions

View File

@@ -162,7 +162,7 @@ class phpbb_console_command_config_test extends phpbb_test_case
'--no-newline' => false,
));
$this->assertContains('CLI_CONFIG_NOT_EXISTS', $command_tester->getDisplay());
$this->assertStringContainsString('CLI_CONFIG_NOT_EXISTS', $command_tester->getDisplay());
}
public function test_increment_dynamic()
@@ -178,7 +178,7 @@ class phpbb_console_command_config_test extends phpbb_test_case
'--dynamic' => true,
));
$this->assertContains('CLI_CONFIG_INCREMENT_SUCCESS', $command_tester->getDisplay());
$this->assertStringContainsString('CLI_CONFIG_INCREMENT_SUCCESS', $command_tester->getDisplay());
$this->assertSame(2, $this->config['test_key']);
}
@@ -195,7 +195,7 @@ class phpbb_console_command_config_test extends phpbb_test_case
'--dynamic' => false,
));
$this->assertContains('CLI_CONFIG_INCREMENT_SUCCESS', $command_tester->getDisplay());
$this->assertStringContainsString('CLI_CONFIG_INCREMENT_SUCCESS', $command_tester->getDisplay());
$this->assertSame(2, $this->config['test_key']);
}
@@ -211,7 +211,7 @@ class phpbb_console_command_config_test extends phpbb_test_case
'--dynamic' => true,
));
$this->assertContains('CLI_CONFIG_INCREMENT_SUCCESS', $command_tester->getDisplay());
$this->assertStringContainsString('CLI_CONFIG_INCREMENT_SUCCESS', $command_tester->getDisplay());
$this->assertSame(2, $this->config['test_key']);
}
@@ -226,7 +226,7 @@ class phpbb_console_command_config_test extends phpbb_test_case
'key' => 'test_key',
));
$this->assertContains('CLI_CONFIG_DELETE_SUCCESS', $command_tester->getDisplay());
$this->assertStringContainsString('CLI_CONFIG_DELETE_SUCCESS', $command_tester->getDisplay());
$this->assertEmpty($this->config);
}
@@ -240,7 +240,7 @@ class phpbb_console_command_config_test extends phpbb_test_case
'key' => 'wrong_key',
));
$this->assertContains('CLI_CONFIG_NOT_EXISTS', $command_tester->getDisplay());
$this->assertStringContainsString('CLI_CONFIG_NOT_EXISTS', $command_tester->getDisplay());
$this->assertEmpty($this->config);
}

View File

@@ -44,19 +44,19 @@ class phpbb_console_command_cron_list_test extends phpbb_test_case
public function test_no_task()
{
$this->initiate_test(0, 0);
$this->assertContains('CRON_NO_TASKS', $this->command_tester->getDisplay());
$this->assertStringContainsString('CRON_NO_TASKS', $this->command_tester->getDisplay());
}
public function test_only_ready()
{
$this->initiate_test(2, 0);
$this->assertContains('TASKS_READY command1 command2', preg_replace('/[\s*=]+/', ' ', trim($this->command_tester->getDisplay())));
$this->assertStringContainsString('TASKS_READY command1 command2', preg_replace('/[\s*=]+/', ' ', trim($this->command_tester->getDisplay())));
}
public function test_only_not_ready()
{
$this->initiate_test(0, 2);
$this->assertContains('TASKS_NOT_READY command1 command2', preg_replace('/[\s*=]+/', ' ', trim($this->command_tester->getDisplay())));
$this->assertStringContainsString('TASKS_NOT_READY command1 command2', preg_replace('/[\s*=]+/', ' ', trim($this->command_tester->getDisplay())));
}
public function test_both_ready()

View File

@@ -103,7 +103,7 @@ class phpbb_console_command_cron_run_test extends phpbb_database_test_case
$command_tester = $this->get_command_tester();
$exit_status = $command_tester->execute(array('command' => $this->command_name, '--verbose' => true));
$this->assertContains('RUNNING_TASK', $command_tester->getDisplay());
$this->assertStringContainsString('RUNNING_TASK', $command_tester->getDisplay());
$this->assertSame(true, $this->task->executed);
$this->assertSame(0, $exit_status);
$this->assertSame(false, $this->lock->owns_lock());
@@ -119,7 +119,7 @@ class phpbb_console_command_cron_run_test extends phpbb_database_test_case
$command_tester = $this->get_command_tester();
$exit_status = $command_tester->execute(array('command' => $this->command_name));
$this->assertContains('CRON_LOCK_ERROR', $command_tester->getDisplay());
$this->assertStringContainsString('CRON_LOCK_ERROR', $command_tester->getDisplay());
$this->assertSame(false, $this->task->executed);
$this->assertSame(1, $exit_status);
}
@@ -215,7 +215,7 @@ class phpbb_console_command_cron_run_test extends phpbb_database_test_case
$command_tester = $this->get_command_tester();
$exit_status = $command_tester->execute(array('command' => $this->command_name, '--verbose' => true));
$this->assertContains('CRON_NO_TASK', $command_tester->getDisplay());
$this->assertStringContainsString('CRON_NO_TASK', $command_tester->getDisplay());
$this->assertSame(0, $exit_status);
$this->assertSame(false, $this->lock->owns_lock());
}
@@ -240,7 +240,7 @@ class phpbb_console_command_cron_run_test extends phpbb_database_test_case
$command_tester = $this->get_command_tester();
$exit_status = $command_tester->execute(array('command' => $this->command_name, 'name' => 'foo'));
$this->assertContains('CRON_NO_SUCH_TASK', $command_tester->getDisplay());
$this->assertStringContainsString('CRON_NO_SUCH_TASK', $command_tester->getDisplay());
$this->assertSame(false, $this->task->executed);
$this->assertSame(2, $exit_status);
$this->assertSame(false, $this->lock->owns_lock());
@@ -251,7 +251,7 @@ class phpbb_console_command_cron_run_test extends phpbb_database_test_case
$command_tester = $this->get_command_tester();
$exit_status = $command_tester->execute(array('command' => $this->command_name, 'name' => 'phpbb_cron_task_simple', '--verbose' => true));
$this->assertContains('RUNNING_TASK', $command_tester->getDisplay());
$this->assertStringContainsString('RUNNING_TASK', $command_tester->getDisplay());
$this->assertSame(true, $this->task->executed);
$this->assertSame(0, $exit_status);
$this->assertSame(false, $this->lock->owns_lock());

View File

@@ -43,7 +43,7 @@ class phpbb_console_command_check_test extends phpbb_test_case
{
$command_tester = $this->get_command_tester('100000');
$status = $command_tester->execute(array('command' => $this->command_name, '--no-ansi' => true, '--verbose' => true));
$this->assertContains($this->language->lang('UPDATE_NOT_NEEDED'), $command_tester->getDisplay());
$this->assertStringContainsString($this->language->lang('UPDATE_NOT_NEEDED'), $command_tester->getDisplay());
$this->assertSame($status, 0);
}
@@ -52,7 +52,7 @@ class phpbb_console_command_check_test extends phpbb_test_case
{
$command_tester = $this->get_command_tester('0');
$status = $command_tester->execute(array('command' => $this->command_name, '--no-ansi' => true));
$this->assertContains($this->language->lang('UPDATE_NEEDED'), $command_tester->getDisplay());
$this->assertStringContainsString($this->language->lang('UPDATE_NEEDED'), $command_tester->getDisplay());
$this->assertSame($status, 1);
}
@@ -60,8 +60,8 @@ class phpbb_console_command_check_test extends phpbb_test_case
{
$command_tester = $this->get_command_tester('0');
$status = $command_tester->execute(array('command' => $this->command_name, '--no-ansi' => true, '--verbose' => true));
$this->assertContains($this->language->lang('UPDATE_NEEDED'), $command_tester->getDisplay());
$this->assertContains($this->language->lang('UPDATES_AVAILABLE'), $command_tester->getDisplay());
$this->assertStringContainsString($this->language->lang('UPDATE_NEEDED'), $command_tester->getDisplay());
$this->assertStringContainsString($this->language->lang('UPDATES_AVAILABLE'), $command_tester->getDisplay());
$this->assertSame($status, 1);
}
@@ -74,7 +74,7 @@ class phpbb_console_command_check_test extends phpbb_test_case
$this->version_helper->set_file_location('acme.corp','foo', 'bar.json');
$status = $command_tester->execute(array('command' => $this->command_name, '--no-ansi' => true));
$this->assertContains('VERSIONCHECK_FAIL', $command_tester->getDisplay());
$this->assertStringContainsString('VERSIONCHECK_FAIL', $command_tester->getDisplay());
$this->assertSame($status, 2);
}

View File

@@ -81,6 +81,6 @@ class phpbb_console_user_activate_test extends phpbb_console_user_base
'--deactivate' => $deactivate,
));
$this->assertContains($expected, $command_tester->getDisplay());
$this->assertStringContainsString($expected, $command_tester->getDisplay());
}
}

View File

@@ -93,7 +93,7 @@ class phpbb_console_user_add_test extends phpbb_console_user_base
));
$this->assertNotEquals(null, $this->get_user_id('foo'));
$this->assertContains('CLI_USER_ADD_SUCCESS', $command_tester->getDisplay());
$this->assertStringContainsString('CLI_USER_ADD_SUCCESS', $command_tester->getDisplay());
}
public function test_add_dialog()
@@ -113,7 +113,7 @@ class phpbb_console_user_add_test extends phpbb_console_user_base
));
$this->assertNotEquals(null, $this->get_user_id('bar'));
$this->assertContains('CLI_USER_ADD_SUCCESS', $command_tester->getDisplay());
$this->assertStringContainsString('CLI_USER_ADD_SUCCESS', $command_tester->getDisplay());
}
@@ -130,8 +130,8 @@ class phpbb_console_user_add_test extends phpbb_console_user_base
'--email' => 'foo'
));
$this->assertContains('USERNAME_TAKEN', $command_tester->getDisplay());
$this->assertContains('TOO_SHORT', $command_tester->getDisplay());
$this->assertContains('EMAIL_INVALID', $command_tester->getDisplay());
$this->assertStringContainsString('USERNAME_TAKEN', $command_tester->getDisplay());
$this->assertStringContainsString('TOO_SHORT', $command_tester->getDisplay());
$this->assertStringContainsString('EMAIL_INVALID', $command_tester->getDisplay());
}
}

View File

@@ -54,7 +54,7 @@ class phpbb_console_user_delete_test extends phpbb_console_user_base
));
$this->assertNull($this->get_user_id('Test'));
$this->assertContains('USER_DELETED', $command_tester->getDisplay());
$this->assertStringContainsString('USER_DELETED', $command_tester->getDisplay());
}
public function test_delete_non_user()
@@ -71,7 +71,7 @@ class phpbb_console_user_delete_test extends phpbb_console_user_base
'--delete-posts' => false,
));
$this->assertContains('NO_USER', $command_tester->getDisplay());
$this->assertStringContainsString('NO_USER', $command_tester->getDisplay());
}
public function test_delete_cancel()