Move ResultWrapper subclasses to Rdbms
[mediawiki.git] / tests / phpunit / includes / skins / SkinTemplateTest.php
blobe8260ac2eeac7651d568464bbbc70796bd514e8a
1 <?php
3 /**
4 * @covers SkinTemplate
6 * @group Output
8 * @author Bene* < benestar.wikimedia@gmail.com >
9 */
11 class SkinTemplateTest extends MediaWikiTestCase {
12 /**
13 * @dataProvider makeListItemProvider
15 public function testMakeListItem( $expected, $key, $item, $options, $message ) {
16 $template = $this->getMockForAbstractClass( 'BaseTemplate' );
18 $this->assertEquals(
19 $expected,
20 $template->makeListItem( $key, $item, $options ),
21 $message
25 public function makeListItemProvider() {
26 return [
28 '<li class="class" title="itemtitle"><a href="url" title="title">text</a></li>',
29 '',
31 'class' => 'class',
32 'itemtitle' => 'itemtitle',
33 'href' => 'url',
34 'title' => 'title',
35 'text' => 'text'
37 [],
38 'Test makeListItem with normal values'
43 /**
44 * @return PHPUnit_Framework_MockObject_MockObject|OutputPage
46 private function getMockOutputPage( $isSyndicated, $html ) {
47 $mock = $this->getMockBuilder( OutputPage::class )
48 ->disableOriginalConstructor()
49 ->getMock();
50 $mock->expects( $this->once() )
51 ->method( 'isSyndicated' )
52 ->will( $this->returnValue( $isSyndicated ) );
53 $mock->expects( $this->once() )
54 ->method( 'getHTML' )
55 ->will( $this->returnValue( $html ) );
56 return $mock;
59 public function provideSetupSkinUserCss() {
60 $defaultStyles = [
61 'mediawiki.legacy.shared',
62 'mediawiki.legacy.commonPrint',
63 'mediawiki.sectionAnchor',
65 $buttonStyle = 'mediawiki.ui.button';
66 $feedStyle = 'mediawiki.feedlink';
67 return [
69 $this->getMockOutputPage( false, '' ),
70 $defaultStyles
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 ] )
87 /**
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 );