Debian Codegraph @

extensions/Scribunto/tests/phpunit/HooksTest.php

raw symbols SCIP
1 <?php
2
3 namespace MediaWiki\Extension\Scribunto\Tests;
4
5 use MediaWiki\Extension\Scribunto\Hooks;
6 use MediaWiki\MediaWikiServices;
7 use MediaWiki\Title\Title;
8 use MediaWikiCoversValidator;
9 use Monolog\Test\TestCase;
10
11 /**
12 * @covers \MediaWiki\Extension\Scribunto\Hooks
13 */
14 class HooksTest extends TestCase {
15 use MediaWikiCoversValidator;
16
17 public static function provideContentHandlerDefaultModelFor() {
18 return [
19 [ 'Module:Foo', CONTENT_MODEL_SCRIBUNTO ],
20 [ 'Module:Foo/doc', null ],
21 [ 'Module:Foo/styles.css', 'sanitized-css', 'sanitized-css' ],
22 [ 'Module:Foo.json', CONTENT_MODEL_JSON ],
23 [ 'Module:Foo/subpage.json', CONTENT_MODEL_JSON ],
24 [ 'Main Page', null ],
25 ];
26 }
27
28 /**
29 * @dataProvider provideContentHandlerDefaultModelFor
30 */
31 public function testContentHandlerDefaultModelFor( $name, $expected,
32 $before = null
33 ) {
34 $title = Title::newFromText( $name );
35 $model = $before;
36 ( new Hooks(
37 MediaWikiServices::getInstance()->getMainConfig()
38 ) )->onContentHandlerDefaultModelFor( $title, $model );
39 $this->assertSame( $expected, $model );
40 }
41 }