7 private static $engineConfigurations = [
9 'memoryLimit' => 50000000,
11 'allowEnvFuncs' =>
true,
12 'maxLangCacheSize' => 30,
17 'memoryLimit' => 50000000,
19 'allowEnvFuncs' =>
true,
20 'maxLangCacheSize' => 30,
24 protected static function makeSuite( $className, $group =
null ) {
25 $suite =
new PHPUnit_Framework_TestSuite;
26 $suite->setName( $className );
28 $class =
new ReflectionClass( $className );
30 foreach ( self::$engineConfigurations as $engineName => $opts ) {
31 if ( $group !==
null && $group !== $engineName ) {
38 $engineClass =
"Scribunto_{$engineName}Engine";
39 $engine =
new $engineClass(
40 self::$engineConfigurations[$engineName] + [
'parser' => $parser ]
42 $parser->scribunto_engine = $engine;
43 $engine->setTitle( $parser->getTitle() );
44 $engine->getInterpreter();
48 $className,
"interpreter for $engineName is not available"
49 ), [
'Lua', $engineName ]
59 self::$staticEngineName = $engineName;
61 $engineSuite =
new PHPUnit_Framework_TestSuite;
62 $engineSuite->setName(
"$engineName: $className" );
64 foreach ( $class->getMethods() as $method ) {
65 if ( PHPUnit_Framework_TestSuite::isTestMethod( $method ) && $method->isPublic() ) {
66 $name = $method->getName();
67 $groups = PHPUnit_Util_Test::getGroups( $className, $name );
69 $groups[] = $engineName;
70 $groups = array_unique( $groups );
72 $data = PHPUnit_Util_Test::getProvidedData( $className, $name );
73 if ( is_array( $data ) || $data instanceof Iterator ) {
75 $dataSuite =
new PHPUnit_Framework_TestSuite_DataProvider(
76 $className .
'::' . $name
78 foreach ( $data as $k => $v ) {
80 new $className( $name, $v, $k, $engineName ),
84 $engineSuite->addTest( $dataSuite );
85 } elseif ( $data ===
false ) {
87 $engineSuite->addTest(
new PHPUnit_Framework_Warning(
88 "The data provider specified for {$className}::$name is invalid."
92 $engineSuite->addTest(
93 new $className( $name, [],
'', $engineName ),
100 $suite->addTest( $engineSuite );
110 if ( !$this->engine ) {
111 $parser =
new Parser;
115 $class =
"Scribunto_{$this->engineName}Engine";
116 $this->engine =
new $class(
117 self::$engineConfigurations[$this->engineName] + [
'parser' => $parser ]
119 $parser->scribunto_engine = $this->engine;
120 $this->engine->setTitle( $parser->getTitle() );
122 return $this->engine;
126 if ( isset( $this->extraModules[
$title->getFullText()] ) ) {
128 'text' => $this->extraModules[
$title->getFullText()],
135 foreach (
$modules as $name => $fileName ) {
137 if ( $modTitle->equals(
$title ) ) {
139 'text' => file_get_contents( $fileName ),
145 return Parser::statelessFetchTemplate(
$title, $parser );