[ticket/16549] Remove exception expectation annotations

PHPBB3-16549
This commit is contained in:
rxu 2020-07-13 14:20:55 +07:00
parent 3d87d61dae
commit 6785db282e
No known key found for this signature in database
GPG key ID: 955F0567380E586A
10 changed files with 27 additions and 49 deletions

View file

@ -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'));

View file

@ -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');

View file

@ -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)
{

View file

@ -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'));
}

View file

@ -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');
}
}

View file

@ -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();

View file

@ -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);
}

View file

@ -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(), '');
}
}

View file

@ -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);
}

View file

@ -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);
}
}