2013-02-05 00:44:44 +00:00
|
|
|
<?php
|
|
|
|
|
2022-07-30 22:43:58 +00:00
|
|
|
namespace MediaWiki\Extension\Scribunto\Tests\Engines\LuaStandalone;
|
|
|
|
|
|
|
|
use MediaWiki\Extension\Scribunto\Tests\Engines\LuaCommon\LuaEngineUnitTestBase;
|
|
|
|
|
2022-08-03 12:31:15 +00:00
|
|
|
class StandaloneTest extends LuaEngineUnitTestBase {
|
2021-01-23 01:33:17 +00:00
|
|
|
/** @inheritDoc */
|
2013-02-05 00:44:44 +00:00
|
|
|
protected static $moduleName = 'StandaloneTests';
|
|
|
|
|
|
|
|
public static function suite( $className ) {
|
|
|
|
return self::makeSuite( $className, 'LuaStandalone' );
|
|
|
|
}
|
|
|
|
|
2021-07-23 10:49:13 +00:00
|
|
|
protected function setUp(): void {
|
2013-09-24 19:07:54 +00:00
|
|
|
parent::setUp();
|
|
|
|
|
|
|
|
$interpreter = $this->getEngine()->getInterpreter();
|
2021-05-13 08:16:18 +00:00
|
|
|
$func = $interpreter->wrapPhpFunction( static function ( $v ) {
|
2017-06-15 17:19:00 +00:00
|
|
|
return [ preg_replace( '/\s+/', ' ', trim( var_export( $v, 1 ) ) ) ];
|
2013-09-24 19:07:54 +00:00
|
|
|
} );
|
|
|
|
$interpreter->callFunction(
|
|
|
|
$interpreter->loadString( 'mw.var_export = ...', 'fortest' ), $func
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2014-11-12 11:21:38 +00:00
|
|
|
protected function getTestModules() {
|
2017-06-15 17:19:00 +00:00
|
|
|
return parent::getTestModules() + [
|
2013-02-05 00:44:44 +00:00
|
|
|
'StandaloneTests' => __DIR__ . '/StandaloneTests.lua',
|
2017-06-15 17:19:00 +00:00
|
|
|
];
|
2013-02-05 00:44:44 +00:00
|
|
|
}
|
|
|
|
}
|