8 * @author Bene* < benestar.wikimedia@gmail.com >
11 class SkinTemplateTest
extends MediaWikiTestCase
{
13 * @dataProvider makeListItemProvider
15 public function testMakeListItem( $expected, $key, $item, $options, $message ) {
16 $template = $this->getMockForAbstractClass( 'BaseTemplate' );
20 $template->makeListItem( $key, $item, $options ),
25 public function makeListItemProvider() {
28 '<li class="class" title="itemtitle"><a href="url" title="title">text</a></li>',
32 'itemtitle' => 'itemtitle',
38 'Test makeListItem with normal values'
44 * @return PHPUnit_Framework_MockObject_MockObject|OutputPage
46 private function getMockOutputPage( $isSyndicated, $html ) {
47 $mock = $this->getMock( OutputPage
::class );
48 $mock->expects( $this->once() )
49 ->method( 'isSyndicated' )
50 ->will( $this->returnValue( $isSyndicated ) );
51 $mock->expects( $this->once() )
53 ->will( $this->returnValue( $html ) );
57 public function provideSetupSkinUserCss() {
59 'mediawiki.legacy.shared',
60 'mediawiki.legacy.commonPrint',
61 'mediawiki.sectionAnchor',
63 $buttonStyle = 'mediawiki.ui.button';
64 $feedStyle = 'mediawiki.feedlink';
67 $this->getMockOutputPage( false, '' ),
71 $this->getMockOutputPage( true, '' ),
72 array_merge( $defaultStyles, [ $feedStyle ] )
75 $this->getMockOutputPage( false, 'FOO mw-ui-button BAR' ),
76 array_merge( $defaultStyles, [ $buttonStyle ] )
79 $this->getMockOutputPage( true, 'FOO mw-ui-button BAR' ),
80 array_merge( $defaultStyles, [ $feedStyle, $buttonStyle ] )
86 * @param PHPUnit_Framework_MockObject_MockObject|OutputPage $outputPageMock
87 * @param string[] $expectedModuleStyles
89 * @covers SkinTemplate::setupSkinUserCss
90 * @dataProvider provideSetupSkinUserCss
92 public function testSetupSkinUserCss( $outputPageMock, $expectedModuleStyles ) {
93 $outputPageMock->expects( $this->once() )
94 ->method( 'addModuleStyles' )
95 ->with( $expectedModuleStyles );
97 $skinTemplate = new SkinTemplate();
98 $skinTemplate->setupSkinUserCss( $outputPageMock );