summaryrefslogtreecommitdiff
path: root/www/wiki/extensions/Scribunto/tests/phpunit/engines/LuaStandalone/StandaloneTest.php
blob: 814c1fac2bb8b9e59f281bbbc2ea9875a8819980 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php

// @codingStandardsIgnoreLine Squiz.Classes.ValidClassName.NotCamelCaps
class Scribunto_LuaStandaloneTest extends Scribunto_LuaEngineTestBase {
	protected static $moduleName = 'StandaloneTests';

	public static function suite( $className ) {
		return self::makeSuite( $className, 'LuaStandalone' );
	}

	protected function setUp() {
		parent::setUp();

		$interpreter = $this->getEngine()->getInterpreter();
		$func = $interpreter->wrapPhpFunction( function ( $v ) {
			return [ preg_replace( '/\s+/', ' ', trim( var_export( $v, 1 ) ) ) ];
		} );
		$interpreter->callFunction(
			$interpreter->loadString( 'mw.var_export = ...', 'fortest' ), $func
		);
	}

	protected function getTestModules() {
		return parent::getTestModules() + [
			'StandaloneTests' => __DIR__ . '/StandaloneTests.lua',
		];
	}
}