From f0a41f6421c63a7f199796f2befe4562ab97bf8f Mon Sep 17 00:00:00 2001 From: Jon Robson Date: Mon, 24 Feb 2025 08:38:35 -0800 Subject: Tests: Ensure that skins only use messages that exist Depends-On: I1b1c776865a1cdef926606ae2c7080ed2a8dcebd Depends-On: I5f25693642f0c778bccec2763f093c8daaef4d32 Change-Id: Iea9563b976e851ec5c6fd01c74bbcb6ef936e2fe --- tests/phpunit/structure/SkinsTest.php | 38 +++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 tests/phpunit/structure/SkinsTest.php (limited to 'tests/phpunit/structure/SkinsTest.php') 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 @@ +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" ); + } + } +} -- cgit v1.2.3