2013-03-04 20:00:59 +00:00
|
|
|
<?php
|
|
|
|
|
2022-08-03 10:03:12 +00:00
|
|
|
class Scribunto_LuaTextLibraryTest extends Scribunto_LuaEngineUnitTestBase {
|
2021-01-23 01:33:17 +00:00
|
|
|
/** @inheritDoc */
|
2013-03-04 20:00:59 +00:00
|
|
|
protected static $moduleName = 'TextLibraryTests';
|
|
|
|
|
2021-07-23 10:49:13 +00:00
|
|
|
protected function setUp(): void {
|
2013-03-04 20:00:59 +00:00
|
|
|
parent::setUp();
|
|
|
|
|
|
|
|
// For unstrip test
|
2014-11-05 17:18:22 +00:00
|
|
|
$parser = $this->getEngine()->getParser();
|
2017-06-15 17:19:00 +00:00
|
|
|
$markers = [
|
2015-06-16 14:22:10 +00:00
|
|
|
'nowiki' => Parser::MARKER_PREFIX . '-test-nowiki-' . Parser::MARKER_SUFFIX,
|
|
|
|
'general' => Parser::MARKER_PREFIX . '-test-general-' . Parser::MARKER_SUFFIX,
|
2022-08-25 00:25:34 +00:00
|
|
|
'ppnowiki' => Parser::MARKER_PREFIX . '-pptest-nowiki-' . Parser::MARKER_SUFFIX,
|
2017-06-15 17:19:00 +00:00
|
|
|
];
|
2021-02-19 21:54:37 +00:00
|
|
|
$parser->getStripState()->addNoWiki( $markers['nowiki'], 'NoWiki' );
|
|
|
|
$parser->getStripState()->addGeneral( $markers['general'], 'General' );
|
2022-08-25 00:25:34 +00:00
|
|
|
$parser->getStripState()->addNoWiki( $markers['ppnowiki'], '<nowiki>PP-NoWiki</nowiki>' );
|
2013-03-04 20:00:59 +00:00
|
|
|
$interpreter = $this->getEngine()->getInterpreter();
|
|
|
|
$interpreter->callFunction(
|
|
|
|
$interpreter->loadString( 'mw.text.stripTest = ...', 'fortest' ),
|
2014-11-05 17:18:22 +00:00
|
|
|
$markers
|
2013-03-04 20:00:59 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2014-11-12 11:21:38 +00:00
|
|
|
protected function getTestModules() {
|
2017-06-15 17:19:00 +00:00
|
|
|
return parent::getTestModules() + [
|
2013-03-04 20:00:59 +00:00
|
|
|
'TextLibraryTests' => __DIR__ . '/TextLibraryTests.lua',
|
2017-06-15 17:19:00 +00:00
|
|
|
];
|
2013-03-04 20:00:59 +00:00
|
|
|
}
|
|
|
|
}
|