MediaWiki  1.34.0
Scribunto_LuaEngineUnitTestBase Class Reference

This is the subclass for Lua library tests. More...

Inheritance diagram for Scribunto_LuaEngineUnitTestBase:
Collaboration diagram for Scribunto_LuaEngineUnitTestBase:

Public Member Functions

 __construct ( $name=null, array $data=[], $dataName='', $engineName=null)
 
 provideLuaData ()
 
 testLua ( $key, $testName, $expected)
 @dataProvider provideLuaData More...
 
 toString ()
 

Static Public Member Functions

static suite ( $className)
 

Protected Member Functions

 getTestModules ()
 
 tearDown ()
 

Protected Attributes

string $luaTestName = null
 Name to display instead of the default. More...
 
array $skipTests = []
 Tests to skip. More...
 

Static Protected Attributes

static string $dataProviderClass = 'Scribunto_LuaDataProvider'
 Class to use for the data provider. More...
 
static string $moduleName = null
 Name of the module being tested. More...
 

Private Attributes

 $engine = null
 
 $engineName = null
 
 $luaDataProvider = null
 

Static Private Attributes

static $staticEngineName = null
 

Detailed Description

This is the subclass for Lua library tests.

It will automatically run all tests against LuaSandbox and LuaStandalone.

Most of the time, you'll only need to override the following:

  • $moduleName: Name of the module being tested
  • getTestModules(): Add a mapping from $moduleName to the file containing the code.

Definition at line 12 of file LuaEngineUnitTestBase.php.

Constructor & Destructor Documentation

◆ __construct()

Scribunto_LuaEngineUnitTestBase::__construct (   $name = null,
array  $data = [],
  $dataName = '',
  $engineName = null 
)

Member Function Documentation

◆ getTestModules()

◆ provideLuaData()

Scribunto_LuaEngineUnitTestBase::provideLuaData ( )

Definition at line 87 of file LuaEngineUnitTestBase.php.

References $luaDataProvider, and getEngine().

Referenced by testLua().

◆ suite()

static Scribunto_LuaEngineUnitTestBase::suite (   $className)
static

Reimplemented in Scribunto_LuaSandboxTest, and Scribunto_LuaStandaloneTest.

Definition at line 56 of file LuaEngineUnitTestBase.php.

References makeSuite().

◆ tearDown()

Scribunto_LuaEngineUnitTestBase::tearDown ( )
protected

Reimplemented in Scribunto_LuaUstringLibraryTest.

Definition at line 60 of file LuaEngineUnitTestBase.php.

◆ testLua()

Scribunto_LuaEngineUnitTestBase::testLua (   $key,
  $testName,
  $expected 
)

@dataProvider provideLuaData

Parameters
string$key
string$testName
mixed$expected

Definition at line 101 of file LuaEngineUnitTestBase.php.

References Scribunto_LuaError\getLuaMessage(), and provideLuaData().

◆ toString()

Scribunto_LuaEngineUnitTestBase::toString ( )

Definition at line 72 of file LuaEngineUnitTestBase.php.

References $luaTestName.

Member Data Documentation

◆ $dataProviderClass

string Scribunto_LuaEngineUnitTestBase::$dataProviderClass = 'Scribunto_LuaDataProvider'
staticprotected

Class to use for the data provider.

Definition at line 38 of file LuaEngineUnitTestBase.php.

◆ $engine

Scribunto_LuaEngineUnitTestBase::$engine = null
private

◆ $engineName

Scribunto_LuaEngineUnitTestBase::$engineName = null
private

◆ $luaDataProvider

Scribunto_LuaEngineUnitTestBase::$luaDataProvider = null
private

Definition at line 20 of file LuaEngineUnitTestBase.php.

Referenced by provideLuaData().

◆ $luaTestName

string Scribunto_LuaEngineUnitTestBase::$luaTestName = null
protected

Name to display instead of the default.

Definition at line 26 of file LuaEngineUnitTestBase.php.

Referenced by toString().

◆ $moduleName

string Scribunto_LuaEngineUnitTestBase::$moduleName = null
staticprotected

Name of the module being tested.

Definition at line 32 of file LuaEngineUnitTestBase.php.

◆ $skipTests

array Scribunto_LuaEngineUnitTestBase::$skipTests = []
protected

Tests to skip.

Associative array mapping test name to skip reason.

Definition at line 44 of file LuaEngineUnitTestBase.php.

◆ $staticEngineName

Scribunto_LuaEngineUnitTestBase::$staticEngineName = null
staticprivate

Definition at line 17 of file LuaEngineUnitTestBase.php.

Referenced by __construct().


The documentation for this class was generated from the following file: