mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Linter
synced 2024-11-27 09:10:05 +00:00
Unbreak CategoryMessagesTest
This test previously wasn't running because the foreach() in the data provider was totally wrong. Also the -details variant for fostered isn't supposed to exist, so hardcode in an exception. Finally, add the @coversNothing annotation since this test is just verifying the contents of en.json, not any PHP code. Change-Id: I7ffffcc3a910aefb082f7ff59265d3be8bc46347
This commit is contained in:
parent
cf04d091ce
commit
06cb0d2930
|
@ -21,18 +21,18 @@
|
|||
namespace MediaWiki\Linter\Test;
|
||||
|
||||
use MediaWiki\Linter\CategoryManager;
|
||||
use MediaWikiTestCase;
|
||||
use MediaWikiLangTestCase;
|
||||
|
||||
/**
|
||||
* Test that all of the messages for new categories
|
||||
* exist
|
||||
*/
|
||||
class CategoryMessagesTest extends MediaWikiTestCase {
|
||||
class CategoryMessagesTest extends MediaWikiLangTestCase {
|
||||
|
||||
public static function provideCategoryNames() {
|
||||
$manager = new CategoryManager();
|
||||
$tests = [];
|
||||
foreach ( $manager as $category ) {
|
||||
foreach ( $manager->getVisibleCategories() as $category ) {
|
||||
$tests[] = [ $category ];
|
||||
}
|
||||
|
||||
|
@ -40,11 +40,23 @@ class CategoryMessagesTest extends MediaWikiTestCase {
|
|||
}
|
||||
|
||||
/**
|
||||
* @coversNothing
|
||||
* @dataProvider provideCategoryNames
|
||||
*/
|
||||
public function testMessagesExistence( $category ) {
|
||||
$this->assertTrue( wfMessage( "linter-category-$category" )->exists() );
|
||||
$this->assertTrue( wfMessage( "linter-category-$category-desc" )->exists() );
|
||||
$this->assertTrue( wfMessage( "linter-pager-$category-details" )->exists() );
|
||||
$msgs = [
|
||||
"linter-category-$category",
|
||||
"linter-category-$category-desc",
|
||||
];
|
||||
if ( $category !== 'fostered' ) {
|
||||
// TODO: Don't hardcode this
|
||||
$msgs[] = "linter-pager-$category-details";
|
||||
}
|
||||
foreach ( $msgs as $msg ) {
|
||||
$this->assertTrue(
|
||||
wfMessage( $msg )->exists(),
|
||||
"Missing '$msg' message"
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue