| 1 |
<?php |
| 2 |
|
| 3 |
namespace MediaWiki\Extension\Scribunto\Tests\Engines\LuaStandalone; |
| 4 |
|
| 5 |
use MediaWiki\Extension\Scribunto\Tests\Engines\LuaCommon\LuaEngineUnitTestBase; |
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
class StandaloneTest extends LuaEngineUnitTestBase { |
| 11 |
|
| 12 |
protected static $moduleName = 'StandaloneTests'; |
| 13 |
|
| 14 |
public static function suite( $className ) { |
| 15 |
return self::makeSuite( $className, 'LuaStandalone' ); |
| 16 |
} |
| 17 |
|
| 18 |
protected function setUp(): void { |
| 19 |
parent::setUp(); |
| 20 |
|
| 21 |
$interpreter = $this->getEngine()->getInterpreter(); |
| 22 |
$func = $interpreter->wrapPhpFunction( static function ( $v ) { |
| 23 |
return [ preg_replace( '/\s+/', ' ', trim( var_export( $v, 1 ) ) ) ]; |
| 24 |
} ); |
| 25 |
$interpreter->callFunction( |
| 26 |
$interpreter->loadString( 'mw.var_export = ...', 'fortest' ), $func |
| 27 |
); |
| 28 |
} |
| 29 |
|
| 30 |
protected function getTestModules() { |
| 31 |
return parent::getTestModules() + [ |
| 32 |
'StandaloneTests' => __DIR__ . '/StandaloneTests.lua', |
| 33 |
]; |
| 34 |
} |
| 35 |
} |