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->getMockBuilder( OutputPage
::class )
48 ->disableOriginalConstructor()
50 $mock->expects( $this->once() )
51 ->method( 'isSyndicated' )
52 ->will( $this->returnValue( $isSyndicated ) );
53 $mock->expects( $this->once() )
55 ->will( $this->returnValue( $html ) );
59 public function provideSetupSkinUserCss() {
61 'mediawiki.legacy.shared',
62 'mediawiki.legacy.commonPrint',
63 'mediawiki.sectionAnchor',
65 $buttonStyle = 'mediawiki.ui.button';
66 $feedStyle = 'mediawiki.feedlink';
69 $this->getMockOutputPage( false, '' ),
73 $this->getMockOutputPage( true, '' ),
74 array_merge( $defaultStyles, [ $feedStyle ] )
77 $this->getMockOutputPage( false, 'FOO mw-ui-button BAR' ),
78 array_merge( $defaultStyles, [ $buttonStyle ] )
81 $this->getMockOutputPage( true, 'FOO mw-ui-button BAR' ),
82 array_merge( $defaultStyles, [ $feedStyle, $buttonStyle ] )
88 * @param PHPUnit_Framework_MockObject_MockObject|OutputPage $outputPageMock
89 * @param string[] $expectedModuleStyles
91 * @covers SkinTemplate::setupSkinUserCss
92 * @dataProvider provideSetupSkinUserCss
94 public function testSetupSkinUserCss( $outputPageMock, $expectedModuleStyles ) {
95 $outputPageMock->expects( $this->once() )
96 ->method( 'addModuleStyles' )
97 ->with( $expectedModuleStyles );
99 $skinTemplate = new SkinTemplate();
100 $skinTemplate->setupSkinUserCss( $outputPageMock );