mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Scribunto
synced 2024-12-12 00:16:12 +00:00
18d122b60d
This reverts commit 62e1fb0b5f
.
Reason for revert: caused several errors:
* unnamespaced HooksTest collides with core’s class of the same name
* Scribunto_LuaError renamed without class alias despite being used in Wikibase
Bug: T314464
Change-Id: I8b151327236bf86945e59823fba155497e4b3fc6
31 lines
897 B
PHP
31 lines
897 B
PHP
<?php
|
|
|
|
use MediaWiki\Extension\Scribunto\Hooks as ScribuntoHooks;
|
|
|
|
class ScribuntoHooksTest extends PHPUnit\Framework\TestCase {
|
|
use MediaWikiCoversValidator;
|
|
|
|
public function provideContentHandlerDefaultModelFor() {
|
|
return [
|
|
[ 'Module:Foo', CONTENT_MODEL_SCRIBUNTO, true ],
|
|
[ 'Module:Foo/doc', null, true ],
|
|
[ 'Module:Foo/styles.css', 'sanitized-css', true, 'sanitized-css' ],
|
|
[ 'Main Page', null, true ],
|
|
];
|
|
}
|
|
|
|
/**
|
|
* @covers \MediaWiki\Extension\Scribunto\Hooks::contentHandlerDefaultModelFor
|
|
* @dataProvider provideContentHandlerDefaultModelFor
|
|
*/
|
|
public function testContentHandlerDefaultModelFor( $name, $expected,
|
|
$retVal, $before = null
|
|
) {
|
|
$title = Title::newFromText( $name );
|
|
$model = $before;
|
|
$ret = ScribuntoHooks::contentHandlerDefaultModelFor( $title, $model );
|
|
$this->assertSame( $retVal, $ret );
|
|
$this->assertSame( $expected, $model );
|
|
}
|
|
}
|