diff --git a/tests/console/cron/run_test.php b/tests/console/cron/run_test.php index 2c532d3c20..f54d0c1aca 100644 --- a/tests/console/cron/run_test.php +++ b/tests/console/cron/run_test.php @@ -105,12 +105,11 @@ class phpbb_console_command_cron_run_test extends phpbb_database_test_case $this->assertSame(false, $this->lock->owns_lock()); } - /** - * @expectedException \phpbb\exception\runtime_exception - * @expectedExceptionMessage CRON_LOCK_ERROR - */ public function test_error_lock() { + $this->expectException(\phpbb\exception\runtime_exception::class); + $this->expectException('CRON_LOCK_ERROR'); + $this->lock->acquire(); $command_tester = $this->get_command_tester(); $exit_status = $command_tester->execute(array('command' => $this->command_name)); @@ -225,12 +224,11 @@ class phpbb_console_command_cron_run_test extends phpbb_database_test_case $this->assertSame(false, $this->lock->owns_lock()); } - /** - * @expectedException \phpbb\exception\runtime_exception - * @expectedExceptionMessage CRON_NO_SUCH_TASK - */ public function test_arg_invalid() { + $this->expectException(\phpbb\exception\runtime_exception::class); + $this->expectException('CRON_NO_SUCH_TASK'); + $command_tester = $this->get_command_tester(); $exit_status = $command_tester->execute(array('command' => $this->command_name, 'name' => 'foo')); diff --git a/tests/console/update/check_test.php b/tests/console/update/check_test.php index e377f247d9..cc434f5583 100644 --- a/tests/console/update/check_test.php +++ b/tests/console/update/check_test.php @@ -65,11 +65,10 @@ class phpbb_console_command_check_test extends phpbb_test_case $this->assertSame($status, 1); } - /** - * @expectedException phpbb\exception\runtime_exception - */ public function test_error() { + $this->expectException(\phpbb\exception\runtime_exception::class); + $command_tester = $this->get_command_tester('1'); $this->version_helper->set_file_location('acme.corp','foo', 'bar.json'); diff --git a/tests/event/php_exporter_test.php b/tests/event/php_exporter_test.php index 2cc2b0c7a0..e93b8a7876 100644 --- a/tests/event/php_exporter_test.php +++ b/tests/event/php_exporter_test.php @@ -169,10 +169,10 @@ class phpbb_event_php_exporter_test extends phpbb_test_case /** * @dataProvider validate_since_throws_data - * @expectedException LogicException */ public function test_validate_since_throws($since) { + $this->expectException('LogicException'); $this->exporter->validate_since($since); } @@ -203,7 +203,6 @@ class phpbb_event_php_exporter_test extends phpbb_test_case /** * @dataProvider validate_event_throws_data - * @expectedException LogicException */ public function test_validate_event_throws($event_name, $event, $exception_code) { @@ -240,10 +239,10 @@ class phpbb_event_php_exporter_test extends phpbb_test_case /** * @dataProvider validate_vars_docblock_array_throws_data - * @expectedException LogicException */ public function test_validate_vars_docblock_array_throws($vars_array, $vars_docblock) { + $this->expectException('LogicException'); $this->exporter->validate_vars_docblock_array($vars_array, $vars_docblock); } @@ -282,10 +281,10 @@ class phpbb_event_php_exporter_test extends phpbb_test_case /** * @dataProvider get_dispatch_name_throws_data - * @expectedException LogicException */ public function test_get_dispatch_name_throws($event_line) { + $this->expectException('LogicException'); $this->exporter->set_content(array($event_line)); $this->exporter->get_event_name(0, true); } @@ -328,10 +327,10 @@ class phpbb_event_php_exporter_test extends phpbb_test_case /** * @dataProvider get_trigger_event_name_throws_data - * @expectedException LogicException */ public function test_get_trigger_event_name_throws($event_line) { + $this->expectException('LogicException'); $this->exporter->set_content(array($event_line)); $this->exporter->get_event_name(0, false); } @@ -459,7 +458,6 @@ class phpbb_event_php_exporter_test extends phpbb_test_case /** * @dataProvider get_vars_from_array_throws_data - * @expectedException LogicException */ public function test_get_vars_from_array_throws($lines, $event_line, $exception_code) { @@ -545,7 +543,6 @@ class phpbb_event_php_exporter_test extends phpbb_test_case /** * @dataProvider get_vars_from_docblock_throws_data - * @expectedException LogicException */ public function test_get_vars_from_docblock_throws($lines, $event_line, $exception_code) { @@ -649,7 +646,6 @@ class phpbb_event_php_exporter_test extends phpbb_test_case /** * @dataProvider find_since_throws_data - * @expectedException LogicException */ public function test_find_since_throws($lines, $event_line, $exception_code) { @@ -751,7 +747,6 @@ class phpbb_event_php_exporter_test extends phpbb_test_case /** * @dataProvider find_description_throws_data - * @expectedException LogicException */ public function test_find_description_throws($lines, $event_line, $exception_code) { diff --git a/tests/functional/lang_test.php b/tests/functional/lang_test.php index 7cffd0ef61..ed3b6786d2 100644 --- a/tests/functional/lang_test.php +++ b/tests/functional/lang_test.php @@ -22,11 +22,9 @@ class phpbb_functional_lang_test extends phpbb_functional_test_case $this->assertEquals('Board index', $this->lang('FORUM_INDEX')); } - /** - * @expectedException RuntimeException - */ public function test_lang_missing() { + $this->expectException('RuntimeException'); $this->assertEquals('Your account has now been activated. Thank you for registering.', $this->lang('ACCOUNT_ACTIVE')); } diff --git a/tests/functions_privmsgs/get_max_setting_from_group_test.php b/tests/functions_privmsgs/get_max_setting_from_group_test.php index b96f490c88..6a9018b6d3 100644 --- a/tests/functions_privmsgs/get_max_setting_from_group_test.php +++ b/tests/functions_privmsgs/get_max_setting_from_group_test.php @@ -54,11 +54,9 @@ class phpbb_functions_privmsgs_get_max_setting_from_group_test extends phpbb_dat $this->assertEquals($expected, phpbb_get_max_setting_from_group($this->db, $user_id, $setting)); } - /** - * @expectedException InvalidArgumentException - */ public function test_get_max_setting_from_group_throws() { + $this->expectException('InvalidArgumentException'); phpbb_get_max_setting_from_group($this->db, ANONYMOUS, 'not_a_setting'); } } diff --git a/tests/migrator/schema_generator_test.php b/tests/migrator/schema_generator_test.php index 2ef5c2e5e1..52f2330dc0 100644 --- a/tests/migrator/schema_generator_test.php +++ b/tests/migrator/schema_generator_test.php @@ -46,11 +46,9 @@ class schema_generator_test extends phpbb_test_case return $this->generator; } - /** - * @expectedException \UnexpectedValueException - */ public function test_check_dependencies_fail() { + $this->expectException(\UnexpectedValueException::class); $this->get_schema_generator(array('\phpbb\db\migration\data\v310\forgot_password')); $this->generator->get_schema(); diff --git a/tests/mimetype/guesser_test.php b/tests/mimetype/guesser_test.php index 7ba5d80ea6..2b6423f1ee 100644 --- a/tests/mimetype/guesser_test.php +++ b/tests/mimetype/guesser_test.php @@ -123,11 +123,10 @@ class guesser_test extends \phpbb_test_case /** * @dataProvider data_incorrect_guessers - * - * @expectedException \LogicException */ public function test_incorrect_guesser($guessers) { + $this->expectException(\LogicException::class); $guesser = new \phpbb\mimetype\guesser($guessers); } diff --git a/tests/template/template_test.php b/tests/template/template_test.php index 01c132e032..51d519a2b1 100644 --- a/tests/template/template_test.php +++ b/tests/template/template_test.php @@ -1073,11 +1073,9 @@ EOT $this->assertEquals("outer - 0 - Test assigning block vars array loop 0:outer - 1 - Test assigning block vars array loop 1:middle - 0 - 1st iterationmiddle - 1 - 2nd iterationmiddle - 2 - 3rd iteration", $this->display('test'), 'Ensuring assigning block vars array to template is working correctly'); } - /** - * @expectedException Twig_Error_Syntax - */ public function test_define_error() { + $this->expectException('Twig_Error_Syntax'); $this->run_template('define_error.html', array(), array(), array(), ''); } } diff --git a/tests/tree/nestedset_forum_insert_delete_test.php b/tests/tree/nestedset_forum_insert_delete_test.php index 6393752010..79ba12b353 100644 --- a/tests/tree/nestedset_forum_insert_delete_test.php +++ b/tests/tree/nestedset_forum_insert_delete_test.php @@ -66,12 +66,11 @@ class phpbb_tests_tree_nestedset_forum_add_remove_test extends phpbb_tests_tree_ /** * @dataProvider delete_throws_data - * - * @expectedException OutOfBoundsException - * @expectedExceptionMessage FORUM_NESTEDSET_INVALID_ITEM */ public function test_delete_throws($explain, $forum_id) { + $this->expectException('OutOfBoundsException'); + $this->expectExceptionMessage('FORUM_NESTEDSET_INVALID_ITEM'); $this->set->delete($forum_id); } diff --git a/tests/tree/nestedset_forum_move_test.php b/tests/tree/nestedset_forum_move_test.php index 108faf5b71..d884117fa0 100644 --- a/tests/tree/nestedset_forum_move_test.php +++ b/tests/tree/nestedset_forum_move_test.php @@ -386,12 +386,11 @@ class phpbb_tests_tree_nestedset_forum_move_test extends phpbb_tests_tree_nested /** * @dataProvider move_children_throws_item_data - * - * @expectedException OutOfBoundsException - * @expectedExceptionMessage FORUM_NESTEDSET_INVALID_ITEM */ public function test_move_children_throws_item($explain, $forum_id, $target_id) { + $this->expectException('OutOfBoundsException'); + $this->expectExceptionMessage('FORUM_NESTEDSET_INVALID_ITEM'); $this->set->move_children($forum_id, $target_id); } @@ -406,12 +405,11 @@ class phpbb_tests_tree_nestedset_forum_move_test extends phpbb_tests_tree_nested /** * @dataProvider move_children_throws_parent_data - * - * @expectedException OutOfBoundsException - * @expectedExceptionMessage FORUM_NESTEDSET_INVALID_PARENT */ public function test_move_children_throws_parent($explain, $forum_id, $target_id) { + $this->expectException('OutOfBoundsException'); + $this->expectExceptionMessage('FORUM_NESTEDSET_INVALID_PARENT'); $this->set->move_children($forum_id, $target_id); } @@ -542,12 +540,11 @@ class phpbb_tests_tree_nestedset_forum_move_test extends phpbb_tests_tree_nested /** * @dataProvider change_parent_throws_item_data - * - * @expectedException OutOfBoundsException - * @expectedExceptionMessage FORUM_NESTEDSET_INVALID_ITEM */ public function test_change_parent_throws_item($explain, $forum_id, $target_id) { + $this->expectException('OutOfBoundsException'); + $this->expectExceptionMessage('FORUM_NESTEDSET_INVALID_ITEM'); $this->set->change_parent($forum_id, $target_id); } @@ -562,12 +559,11 @@ class phpbb_tests_tree_nestedset_forum_move_test extends phpbb_tests_tree_nested /** * @dataProvider change_parent_throws_parent_data - * - * @expectedException OutOfBoundsException - * @expectedExceptionMessage FORUM_NESTEDSET_INVALID_PARENT */ public function test_change_parent_throws_parent($explain, $forum_id, $target_id) { + $this->expectException('OutOfBoundsException'); + $this->expectExceptionMessage('FORUM_NESTEDSET_INVALID_PARENT'); $this->set->change_parent($forum_id, $target_id); } }