dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge "Type hint against LinkTarget in WatchedItemStore"
[lhc/web/wiklou.git]
/
tests
/
phpunit
/
structure
/
AvailableRightsTest.php
diff --git
a/tests/phpunit/structure/AvailableRightsTest.php
b/tests/phpunit/structure/AvailableRightsTest.php
index
a7d947e
..
2a6575a
100644
(file)
--- a/
tests/phpunit/structure/AvailableRightsTest.php
+++ b/
tests/phpunit/structure/AvailableRightsTest.php
@@
-35,9
+35,6
@@
class AvailableRightsTest extends PHPUnit\Framework\TestCase {
return $rights;
}
return $rights;
}
- /**
- * @coversNothing
- */
public function testAvailableRights() {
$missingRights = array_diff(
$this->getAllVisibleRights(),
public function testAvailableRights() {
$missingRights = array_diff(
$this->getAllVisibleRights(),
@@
-55,34
+52,50
@@
class AvailableRightsTest extends PHPUnit\Framework\TestCase {
}
/**
}
/**
- * Test, if for all rights a
right
- message exist,
+ * Test, if for all rights a
n action
- message exist,
* which is used on Special:ListGroupRights as help text
* Extensions and core
*
* @coversNothing
*/
* which is used on Special:ListGroupRights as help text
* Extensions and core
*
* @coversNothing
*/
+ public function testAllActionsWithMessages() {
+ $this->checkMessagesExist( 'action-' );
+ }
+
+ /**
+ * Test, if for all rights a right- message exist,
+ * which is used on Special:ListGroupRights as help text
+ * Extensions and core
+ */
public function testAllRightsWithMessage() {
public function testAllRightsWithMessage() {
+ $this->checkMessagesExist( 'right-' );
+ }
+
+ /**
+ * @param string $prefix
+ */
+ private function checkMessagesExist( $prefix ) {
// Getting all user rights, for core: User::$mCoreRights, for extensions: $wgAvailableRights
$allRights = User::getAllRights();
$allMessageKeys = Language::getMessageKeysFor( 'en' );
// Getting all user rights, for core: User::$mCoreRights, for extensions: $wgAvailableRights
$allRights = User::getAllRights();
$allMessageKeys = Language::getMessageKeysFor( 'en' );
- $
rightsWithMessage
= [];
+ $
messagesToCheck
= [];
foreach ( $allMessageKeys as $message ) {
// === 0: must be at beginning of string (position 0)
foreach ( $allMessageKeys as $message ) {
// === 0: must be at beginning of string (position 0)
- if ( strpos( $message,
'right-'
) === 0 ) {
- $
rightsWithMessage[] = substr( $message, strlen( 'right-'
) );
+ if ( strpos( $message,
$prefix
) === 0 ) {
+ $
messagesToCheck[] = substr( $message, strlen( $prefix
) );
}
}
$missing = array_diff(
$allRights,
}
}
$missing = array_diff(
$allRights,
- $
rightsWithMessage
+ $
messagesToCheck
);
$this->assertEquals(
[],
$missing,
);
$this->assertEquals(
[],
$missing,
- 'Each user rights (core/extensions) has a corresponding right- message.'
+ "Each user right (core/extensions) has a corresponding $prefix message."
);
}
}
);
}
}