MediaWiki REL1_34
Scribunto_LuaEngineTestBase Class Reference

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

Inheritance diagram for Scribunto_LuaEngineTestBase:
Collaboration diagram for Scribunto_LuaEngineTestBase:

Public Member Functions

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

Static Public Member Functions

static suite ( $className)
 

Protected Member Functions

 getTestModules ()
 
 getTestTitle ()
 Get the title used for unit tests.
 
 tearDown ()
 

Protected Attributes

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

Static Protected Attributes

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

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 LuaEngineTestBase.php.

Constructor & Destructor Documentation

◆ __construct()

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

Definition at line 44 of file LuaEngineTestBase.php.

References $engineName, and $staticEngineName.

Member Function Documentation

◆ getTestModules()

Scribunto_LuaEngineTestBase::getTestModules ( )
protected

◆ getTestTitle()

Scribunto_LuaEngineTestBase::getTestTitle ( )
protected

Get the title used for unit tests.

Returns
Title

Definition at line 75 of file LuaEngineTestBase.php.

◆ provideLuaData()

Scribunto_LuaEngineTestBase::provideLuaData ( )

Definition at line 94 of file LuaEngineTestBase.php.

References $luaDataProvider, and getEngine().

Referenced by testLua().

◆ suite()

static Scribunto_LuaEngineTestBase::suite ( $className)
static

Reimplemented in Scribunto_LuaTitleLibraryTest.

Definition at line 54 of file LuaEngineTestBase.php.

References makeSuite().

◆ tearDown()

Scribunto_LuaEngineTestBase::tearDown ( )
protected

Reimplemented in Scribunto_LuaTitleLibraryTest.

Definition at line 58 of file LuaEngineTestBase.php.

◆ testLua()

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

@dataProvider provideLuaData

Parameters
string$key
string$testName
mixed$expected

Definition at line 108 of file LuaEngineTestBase.php.

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

◆ toString()

Scribunto_LuaEngineTestBase::toString ( )

Definition at line 79 of file LuaEngineTestBase.php.

References $luaTestName.

Member Data Documentation

◆ $dataProviderClass

string Scribunto_LuaEngineTestBase::$dataProviderClass = 'Scribunto_LuaDataProvider'
staticprotected

Class to use for the data provider.

Definition at line 36 of file LuaEngineTestBase.php.

◆ $engine

◆ $engineName

Scribunto_LuaEngineTestBase::$engineName = null
private

Definition at line 16 of file LuaEngineTestBase.php.

Referenced by __construct().

◆ $luaDataProvider

Scribunto_LuaEngineTestBase::$luaDataProvider = null
private

Definition at line 18 of file LuaEngineTestBase.php.

Referenced by provideLuaData().

◆ $luaTestName

string Scribunto_LuaEngineTestBase::$luaTestName = null
protected

Name to display instead of the default.

Definition at line 24 of file LuaEngineTestBase.php.

Referenced by toString().

◆ $moduleName

string Scribunto_LuaEngineTestBase::$moduleName = null
staticprotected

Name of the module being tested.

Definition at line 30 of file LuaEngineTestBase.php.

◆ $skipTests

array Scribunto_LuaEngineTestBase::$skipTests = []
protected

Tests to skip.

Associative array mapping test name to skip reason.

Definition at line 42 of file LuaEngineTestBase.php.

◆ $staticEngineName

Scribunto_LuaEngineTestBase::$staticEngineName = null
staticprivate

Definition at line 15 of file LuaEngineTestBase.php.

Referenced by __construct().


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