From 92a0197c9f9233f76acb6b993c0969835c2732bc Mon Sep 17 00:00:00 2001 From: "Sean Leong (WMDE)" Date: Mon, 16 Sep 2024 12:44:57 +0200 Subject: [PATCH] feat: additional test coverage for Minerva 'TOOLBOX' Bug: T66315 Change-Id: I03cb66a55fddcbae31e6f59f268ccfa7a31318ef --- tests/phpunit/skins/SkinMinervaTest.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/phpunit/skins/SkinMinervaTest.php b/tests/phpunit/skins/SkinMinervaTest.php index 7f85500bd..7724795ab 100644 --- a/tests/phpunit/skins/SkinMinervaTest.php +++ b/tests/phpunit/skins/SkinMinervaTest.php @@ -112,6 +112,18 @@ class SkinMinervaTest extends MediaWikiIntegrationTestCase { ] ] ], true ]; + yield "wikibase item exists in both toolbar and in other projects" => [ [ + 'TOOLBOX' => [ + 'wikibase' => [ + 'id' => 't-wikibase', + ], + ], + 'wikibase-otherprojects' => [ + [ + 'id' => 't-wikibase', + ] + ] + ], true ]; yield "no wikibase item connected" => [ [ 'TOOLBOX' => [ ], @@ -129,8 +141,10 @@ class SkinMinervaTest extends MediaWikiIntegrationTestCase { $sidebar = SkinMinerva::moveWikibaseLinkToToolbox( $sidebar ); if ( $linkExists ) { $this->assertArrayHasKey( 'wikibase', $sidebar['TOOLBOX'] ); + $this->assertEquals( 'wikibase', array_key_last( $sidebar['TOOLBOX'] ) ); } else { $this->assertArrayNotHasKey( 'wikibase', $sidebar['TOOLBOX'] ?? [] ); + $this->assertNotEquals( 'wikibase', array_key_last( $sidebar['TOOLBOX'] ?? [] ) ); } }