aboutsummaryrefslogtreecommitdiffstats
path: root/tests/dbal/migrator_tool_permission_test.php
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2015-06-09 20:23:29 +0200
committerJoas Schilling <nickvergessen@gmx.de>2015-06-09 20:23:29 +0200
commit00c15c76c30719773dab26949445a143870ddbee (patch)
tree561fad722b8198d002293c5ec165a16063503155 /tests/dbal/migrator_tool_permission_test.php
parent47ef99f6ef5ee781264797da74c4bf4076ae3d11 (diff)
parent832c9f64e04ad22dce1d51e72f3c65df4894c0eb (diff)
downloadforums-00c15c76c30719773dab26949445a143870ddbee.tar
forums-00c15c76c30719773dab26949445a143870ddbee.tar.gz
forums-00c15c76c30719773dab26949445a143870ddbee.tar.bz2
forums-00c15c76c30719773dab26949445a143870ddbee.tar.xz
forums-00c15c76c30719773dab26949445a143870ddbee.zip
Merge branch '3.1.x'
Diffstat (limited to 'tests/dbal/migrator_tool_permission_test.php')
-rw-r--r--tests/dbal/migrator_tool_permission_test.php62
1 files changed, 62 insertions, 0 deletions
diff --git a/tests/dbal/migrator_tool_permission_test.php b/tests/dbal/migrator_tool_permission_test.php
index 3d190e7a11..bfb2e07080 100644
--- a/tests/dbal/migrator_tool_permission_test.php
+++ b/tests/dbal/migrator_tool_permission_test.php
@@ -15,6 +15,12 @@ require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
class phpbb_dbal_migrator_tool_permission_test extends phpbb_database_test_case
{
+ public $group_ids = array(
+ 'REGISTERED' => 2,
+ 'GLOBAL_MODERATORS' => 4,
+ 'ADMINISTRATORS' => 5,
+ );
+
public function getDataSet()
{
return $this->createXMLDataSet(dirname(__FILE__).'/fixtures/migrator_permission.xml');
@@ -158,4 +164,60 @@ class phpbb_dbal_migrator_tool_permission_test extends phpbb_database_test_case
}
$this->assertFalse($this->tool->exists('global_test', true));
}
+
+ public function test_permission_set_data()
+ {
+ return array(
+ array(
+ 'ADMINISTRATORS',
+ 'a_test',
+ 'group',
+ true,
+ ),
+ array(
+ 'GLOBAL_MODERATORS',
+ 'm_test',
+ 'group',
+ true,
+ ),
+ array(
+ 'REGISTERED',
+ 'u_test',
+ 'group',
+ true,
+ ),
+ );
+ }
+
+ /**
+ * @dataProvider test_permission_set_data
+ */
+ public function test_permission_set($group_name, $auth_option, $type, $has_permission)
+ {
+ $this->tool->permission_set($group_name, $auth_option, $type, $has_permission);
+ $administrators_perm = $this->auth->acl_group_raw_data($this->group_ids['ADMINISTRATORS'], $auth_option);
+ $global_moderators_perm = $this->auth->acl_group_raw_data($this->group_ids['GLOBAL_MODERATORS'], $auth_option);
+ $registered_users_perm = $this->auth->acl_group_raw_data($this->group_ids['REGISTERED'], $auth_option);
+
+ switch($group_name)
+ {
+ case 'GLOBAL_MODERATORS':
+ $this->assertEquals(false, empty($administrators_perm), 'm_test is not empty for Administrators');
+ $this->assertEquals(false, empty($global_moderators_perm), 'm_test is not empty for Global moderators');
+ $this->assertEquals(true, empty($registered_users_perm), 'm_test empty for Registered users');
+ break;
+
+ case 'ADMINISTRATORS':
+ $this->assertEquals(false, empty($administrators_perm), 'a_test is not empty for Administrators');
+ $this->assertEquals(true, empty($global_moderators_perm), 'a_test is empty for Global moderators');
+ $this->assertEquals(true, empty($registered_users_perm), 'a_test is empty for Registered users');
+ break;
+
+ case 'REGISTERED':
+ $this->assertEquals(false, empty($administrators_perm), 'u_test is not empty for Administrators');
+ $this->assertEquals(false, empty($global_moderators_perm), 'u_test is not empty for Global moderators');
+ $this->assertEquals(false, empty($registered_users_perm), 'u_test is not empty for Registered users');
+ break;
+ }
+ }
}