From ca32f08966f1b51fcb19460f0996bb0c4048e6fe Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Sat, 3 Dec 2011 13:29:22 +0100 Subject: Update to MediaWiki 1.18.0 * also update ArchLinux skin to chagnes in MonoBook * Use only css to hide our menu bar when printing --- tests/phpunit/includes/UserTest.php | 58 +++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 tests/phpunit/includes/UserTest.php (limited to 'tests/phpunit/includes/UserTest.php') diff --git a/tests/phpunit/includes/UserTest.php b/tests/phpunit/includes/UserTest.php new file mode 100644 index 00000000..df91aca8 --- /dev/null +++ b/tests/phpunit/includes/UserTest.php @@ -0,0 +1,58 @@ +savedGroupPermissions = $GLOBALS['wgGroupPermissions']; + $this->savedRevokedPermissions = $GLOBALS['wgRevokePermissions']; + + $this->setUpPermissionGlobals(); + } + private function setUpPermissionGlobals() { + global $wgGroupPermissions, $wgRevokePermissions; + + $wgGroupPermissions['unittesters'] = array( + 'runtest' => true, + 'writetest' => false, + 'nukeworld' => false, + ); + $wgGroupPermissions['testwriters'] = array( + 'writetest' => true, + 'modifytest' => true, + ); + + $wgRevokePermissions['formertesters'] = array( + 'runtest' => true, + ); + } + public function tearDown() { + parent::tearDown(); + + $GLOBALS['wgGroupPermissions'] = $this->savedGroupPermissions; + $GLOBALS['wgRevokePermissions'] = $this->savedRevokedPermissions; + } + + public function testGroupPermissions() { + $rights = User::getGroupPermissions( array( 'unittesters' ) ); + $this->assertContains( 'runtest', $rights ); + $this->assertNotContains( 'writetest', $rights ); + $this->assertNotContains( 'modifytest', $rights ); + $this->assertNotContains( 'nukeworld', $rights ); + + $rights = User::getGroupPermissions( array( 'unittesters', 'testwriters' ) ); + $this->assertContains( 'runtest', $rights ); + $this->assertContains( 'writetest', $rights ); + $this->assertContains( 'modifytest', $rights ); + $this->assertNotContains( 'nukeworld', $rights ); + } + public function testRevokePermissions() { + $rights = User::getGroupPermissions( array( 'unittesters', 'formertesters' ) ); + $this->assertNotContains( 'runtest', $rights ); + $this->assertNotContains( 'writetest', $rights ); + $this->assertNotContains( 'modifytest', $rights ); + $this->assertNotContains( 'nukeworld', $rights ); + } +} \ No newline at end of file -- cgit v1.2.3-54-g00ecf