mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-10 13:28:55 +00:00
[ticket/10411] Test for thrown exceptions when group does not exist
PHPBB3-10411
This commit is contained in:
parent
9e70f7a4e0
commit
1261583afa
2 changed files with 18 additions and 6 deletions
|
@ -18,15 +18,16 @@ class phpbb_groupposition_legend_test extends phpbb_database_test_case
|
||||||
public function get_group_value_data()
|
public function get_group_value_data()
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
array(1, 0),
|
array(1, 0, ''),
|
||||||
array(3, 2),
|
array(3, 2, ''),
|
||||||
|
array(4, 0, 'phpbb_groupposition_exception'),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider get_group_value_data
|
* @dataProvider get_group_value_data
|
||||||
*/
|
*/
|
||||||
public function test_get_group_value($group_id, $expected)
|
public function test_get_group_value($group_id, $expected, $throws_exception)
|
||||||
{
|
{
|
||||||
global $cache;
|
global $cache;
|
||||||
|
|
||||||
|
@ -35,6 +36,11 @@ class phpbb_groupposition_legend_test extends phpbb_database_test_case
|
||||||
$user = new phpbb_user;
|
$user = new phpbb_user;
|
||||||
$user->lang = array();
|
$user->lang = array();
|
||||||
|
|
||||||
|
if ($throws_exception)
|
||||||
|
{
|
||||||
|
$this->setExpectedException($throws_exception);
|
||||||
|
}
|
||||||
|
|
||||||
$test_class = new phpbb_groupposition_legend($db, $user);
|
$test_class = new phpbb_groupposition_legend($db, $user);
|
||||||
$this->assertEquals($expected, $test_class->get_group_value($group_id));
|
$this->assertEquals($expected, $test_class->get_group_value($group_id));
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,15 +20,16 @@ class phpbb_groupposition_teampage_test extends phpbb_database_test_case
|
||||||
public function get_group_value_data()
|
public function get_group_value_data()
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
array(2, 3),
|
array(2, 3, ''),
|
||||||
array(6, 8),
|
array(6, 8, ''),
|
||||||
|
array(10, 0, 'phpbb_groupposition_exception'),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider get_group_value_data
|
* @dataProvider get_group_value_data
|
||||||
*/
|
*/
|
||||||
public function test_get_group_value($group_id, $expected)
|
public function test_get_group_value($group_id, $expected, $throws_exception)
|
||||||
{
|
{
|
||||||
global $cache;
|
global $cache;
|
||||||
|
|
||||||
|
@ -37,6 +38,11 @@ class phpbb_groupposition_teampage_test extends phpbb_database_test_case
|
||||||
$user = new phpbb_user;
|
$user = new phpbb_user;
|
||||||
$user->lang = array();
|
$user->lang = array();
|
||||||
|
|
||||||
|
if ($throws_exception)
|
||||||
|
{
|
||||||
|
$this->setExpectedException($throws_exception);
|
||||||
|
}
|
||||||
|
|
||||||
$test_class = new phpbb_groupposition_teampage($db, $user, $cache);
|
$test_class = new phpbb_groupposition_teampage($db, $user, $cache);
|
||||||
$this->assertEquals($expected, $test_class->get_group_value($group_id));
|
$this->assertEquals($expected, $test_class->get_group_value($group_id));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue