-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathLuaLibraryParseTest.php
More file actions
57 lines (51 loc) · 1.33 KB
/
LuaLibraryParseTest.php
File metadata and controls
57 lines (51 loc) · 1.33 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php
namespace MediaWiki\Extension\BootstrapComponents\Tests\Unit;
/**
* @covers \MediaWiki\Extension\BootstrapComponents\LuaLibrary
* @ingroup Test
*
* @group extension-bootstrap-components
* @group Database
*
* @license GNU GPL v3+
*
* @since 1.1
* @author Tobias Oetterer
*/
class LuaLibraryParseTest extends LuaLibraryTestBase {
/**
* Lua test module
* @var string
*/
protected static $moduleName = self::class;
/**
* LuaLibraryTestBase::getTestModules
*/
public function getTestModules(): array
{
return parent::getTestModules() + array(
self::$moduleName => __DIR__ . '/' . 'mw.bootstrap.parse.tests.lua',
);
}
/**
* Tests method parse
*/
public function testParse() {
$this->assertArrayHasKey(
0,
$this->getLuaLibrary()->parse( '', '', [] )
);
$this->assertEquals(
'No component name provided for mw.bootstrap.parse.',
$this->getLuaLibrary()->parse( '', '', [] )[0]
);
$this->assertEquals(
'Invalid component name passed to mw.bootstrap.parse: foobar.',
$this->getLuaLibrary()->parse( 'foobar', '', [] )[0]
);
$this->assertEquals(
'<div class="card border-danger"><div id="FooBar"><div class="card-body text-danger">Lorem Ipsum</div></div></div>',
$this->getLuaLibrary()->parse( 'card', 'Lorem Ipsum', [ 'color' => 'danger', 'id' => 'FooBar' ], true )[0]
);
}
}