MediaWiki  1.34.0
HooksTest.php
Go to the documentation of this file.
1 <?php
2 
3 class ScribuntoHooksTest extends PHPUnit\Framework\TestCase {
4  use MediaWikiCoversValidator;
5  use PHPUnit4And6Compat;
6 
8  return [
9  [ 'Module:Foo', CONTENT_MODEL_SCRIBUNTO, true ],
10  [ 'Module:Foo/doc', null, true ],
11  [ 'Module:Foo/styles.css', 'sanitized-css', true, 'sanitized-css' ],
12  [ 'Main Page', null, true ],
13  ];
14  }
15 
20  public function testContentHandlerDefaultModelFor( $name, $expected,
21  $retVal, $before = null
22  ) {
23  $title = Title::newFromText( $name );
24  $model = $before;
26  $this->assertSame( $retVal, $ret );
27  $this->assertSame( $expected, $model );
28  }
29 }
Title\newFromText
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
Definition: Title.php:316
true
return true
Definition: router.php:92
$title
$title
Definition: testCompression.php:34
ScribuntoHooksTest\provideContentHandlerDefaultModelFor
provideContentHandlerDefaultModelFor()
Definition: HooksTest.php:7
ScribuntoHooksTest\testContentHandlerDefaultModelFor
testContentHandlerDefaultModelFor( $name, $expected, $retVal, $before=null)
@covers ScribuntoHooks::contentHandlerDefaultModelFor @dataProvider provideContentHandlerDefaultModel...
Definition: HooksTest.php:20
ScribuntoHooksTest
Definition: HooksTest.php:3
ScribuntoHooks\contentHandlerDefaultModelFor
static contentHandlerDefaultModelFor(Title $title, &$model)
Set the Scribunto content handler for modules.
Definition: Hooks.php:263