mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/MinervaNeue
synced 2024-11-17 19:21:39 +00:00
6905b85d67
The Group shouldn't depend upon concrete MenuEntry definition. Different Menus can present different MenuElements. Code should allow easy extensions, not limit only to single MenuEntry definition. Changes: - introduced IMenuEntry interface - MenuEntry implements IMenuEntry - removed isJSOnly from logic as it's related only to one menu element (Watchstar) and Group shouldn't be aware of some special handling for some elements. The IMenuEntry shouldn't define this method - getName, getComponents, getCSSClasses should have defined return types Bug: 1221792 Change-Id: I0646df734e869c26bfa8c3a772200e8258a8acce
28 lines
650 B
PHP
28 lines
650 B
PHP
<?php
|
|
|
|
namespace Tests\MediaWiki\Minerva\Menu;
|
|
|
|
use MediaWiki\Minerva\Menu\MenuEntry;
|
|
|
|
/**
|
|
* @group MinervaNeue
|
|
* @coversDefaultClass \MediaWiki\Minerva\Menu\MenuEntry
|
|
*/
|
|
class MenuEntryTest extends \MediaWikiTestCase {
|
|
|
|
/**
|
|
* @covers ::__construct
|
|
* @covers ::getName()
|
|
* @covers ::getCSSClasses()
|
|
* @covers ::getComponents()
|
|
*/
|
|
public function testMenuEntryConstruction() {
|
|
$name = 'test';
|
|
$isJSOnly = true;
|
|
$entry = new MenuEntry( $name, $isJSOnly );
|
|
$this->assertSame( $name, $entry->getName() );
|
|
$this->assertArrayEquals( [ 'jsonly' ], $entry->getCSSClasses() );
|
|
$this->assertSame( [], $entry->getComponents() );
|
|
}
|
|
}
|