diff options
author | Jon Robson <jdlrobson@gmail.com> | 2025-02-24 08:38:35 -0800 |
---|---|---|
committer | Jforrester <jforrester@wikimedia.org> | 2025-02-28 15:43:29 +0000 |
commit | f0a41f6421c63a7f199796f2befe4562ab97bf8f (patch) | |
tree | f9e0cb12f5f7d60424d1f69f7d4dd7564df2aaf4 /tests/phpunit/structure/SkinsTest.php | |
parent | 43629bebb0f55ba8b29d01ba2e5ac999661046f2 (diff) | |
download | mediawikicore-f0a41f6421c63a7f199796f2befe4562ab97bf8f.tar.gz mediawikicore-f0a41f6421c63a7f199796f2befe4562ab97bf8f.zip |
Tests: Ensure that skins only use messages that exist
Depends-On: I1b1c776865a1cdef926606ae2c7080ed2a8dcebd
Depends-On: I5f25693642f0c778bccec2763f093c8daaef4d32
Change-Id: Iea9563b976e851ec5c6fd01c74bbcb6ef936e2fe
Diffstat (limited to 'tests/phpunit/structure/SkinsTest.php')
-rw-r--r-- | tests/phpunit/structure/SkinsTest.php | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/phpunit/structure/SkinsTest.php b/tests/phpunit/structure/SkinsTest.php new file mode 100644 index 000000000000..ede44af822a6 --- /dev/null +++ b/tests/phpunit/structure/SkinsTest.php @@ -0,0 +1,38 @@ +<?php + +use MediaWiki\MediaWikiServices; +use MediaWiki\Message\Message; + +/** + * Checks for making sure registered skins are sensible. + * + * @coversNothing + * @group Database + */ +class SkinsTest extends MediaWikiIntegrationTestCase { + + public static function provideSkinConstructor() { + $services = MediaWikiServices::getInstance(); + $skinFactory = $services->getSkinFactory(); + foreach ( array_keys( $skinFactory->getInstalledSkins() ) as $skin ) { + yield [ $skinFactory, $skin ]; + } + } + + /** + * @dataProvider provideSkinConstructor + * + * @param string $skinFactory + * @param string $skinName + */ + public function testConstructor( SkinFactory $skinFactory, string $skinName ) { + $skin = $skinFactory->makeSkin( $skinName ); + $options = $skin->getOptions(); + $messages = $options['messages'] ?? []; + $this->assertSame( $options['name'], $skinName ); + foreach ( $messages as $message ) { + $msg = new Message( $message ); + $this->assertSame( true, $msg->exists(), "Skin references message that does not exist: $message" ); + } + } +} |