summaryrefslogtreecommitdiff
path: root/tests/phpunit/includes/UserTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/phpunit/includes/UserTest.php')
-rw-r--r--tests/phpunit/includes/UserTest.php20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/phpunit/includes/UserTest.php b/tests/phpunit/includes/UserTest.php
index e777179a..ff33e825 100644
--- a/tests/phpunit/includes/UserTest.php
+++ b/tests/phpunit/includes/UserTest.php
@@ -46,8 +46,16 @@ class UserTest extends MediaWikiTestCase {
$wgRevokePermissions['formertesters'] = array(
'runtest' => true,
);
+
+ # For the options test
+ $wgGroupPermissions['*'] = array(
+ 'editmyoptions' => true,
+ );
}
+ /**
+ * @covers User::getGroupPermissions
+ */
public function testGroupPermissions() {
$rights = User::getGroupPermissions( array( 'unittesters' ) );
$this->assertContains( 'runtest', $rights );
@@ -62,6 +70,9 @@ class UserTest extends MediaWikiTestCase {
$this->assertNotContains( 'nukeworld', $rights );
}
+ /**
+ * @covers User::getGroupPermissions
+ */
public function testRevokePermissions() {
$rights = User::getGroupPermissions( array( 'unittesters', 'formertesters' ) );
$this->assertNotContains( 'runtest', $rights );
@@ -70,6 +81,9 @@ class UserTest extends MediaWikiTestCase {
$this->assertNotContains( 'nukeworld', $rights );
}
+ /**
+ * @covers User::getRights
+ */
public function testUserPermissions() {
$rights = $this->user->getRights();
$this->assertContains( 'runtest', $rights );
@@ -80,6 +94,7 @@ class UserTest extends MediaWikiTestCase {
/**
* @dataProvider provideGetGroupsWithPermission
+ * @covers User::getGroupsWithPermission
*/
public function testGetGroupsWithPermission( $expected, $right ) {
$result = User::getGroupsWithPermission( $right );
@@ -112,6 +127,7 @@ class UserTest extends MediaWikiTestCase {
/**
* @dataProvider provideUserNames
+ * @covers User::isValidUserName
*/
public function testIsValidUserName( $username, $result, $message ) {
$this->assertEquals( $this->user->isValidUserName( $username ), $result, $message );
@@ -166,6 +182,7 @@ class UserTest extends MediaWikiTestCase {
/**
* Test User::editCount
* @group medium
+ * @covers User::getEditCount
*/
public function testEditCount() {
$user = User::newFromName( 'UnitTestUser' );
@@ -190,6 +207,8 @@ class UserTest extends MediaWikiTestCase {
/**
* Test changing user options.
+ * @covers User::setOption
+ * @covers User::getOption
*/
public function testOptions() {
$user = User::newFromName( 'UnitTestUser' );
@@ -207,6 +226,7 @@ class UserTest extends MediaWikiTestCase {
/**
* Bug 37963
* Make sure defaults are loaded when setOption is called.
+ * @covers User::loadOptions
*/
public function testAnonOptions() {
global $wgDefaultUserOptions;