diff options
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" ); + } + } +} |