|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace BootstrapComponents\Tests\Unit\Components; |
|
4
|
|
|
|
|
5
|
|
|
use BootstrapComponents\Components\Jumbotron; |
|
6
|
|
|
use BootstrapComponents\Tests\Unit\ComponentsTestBase; |
|
7
|
|
|
use \MWException; |
|
8
|
|
|
|
|
9
|
|
|
/** |
|
10
|
|
|
* @covers \BootstrapComponents\Components\Jumbotron |
|
11
|
|
|
* |
|
12
|
|
|
* @ingroup Test |
|
13
|
|
|
* |
|
14
|
|
|
* @group extension-bootstrap-components |
|
15
|
|
|
* @group mediawiki-databaseless |
|
16
|
|
|
* |
|
17
|
|
|
* @license GNU GPL v3+ |
|
18
|
|
|
* |
|
19
|
|
|
* @since 1.0 |
|
20
|
|
|
* @author Tobias Oetterer |
|
21
|
|
|
*/ |
|
22
|
|
|
class JumbotronTest extends ComponentsTestBase { |
|
23
|
|
|
|
|
24
|
|
|
private $input = 'Jumbotron test text'; |
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* @throws \MWException |
|
28
|
|
|
*/ |
|
29
|
|
|
public function testCanConstruct() { |
|
30
|
|
|
|
|
31
|
|
|
$this->assertInstanceOf( |
|
32
|
|
|
'BootstrapComponents\\Components\\Jumbotron', |
|
33
|
|
|
new Jumbotron( |
|
34
|
|
|
$this->getComponentLibrary(), |
|
35
|
|
|
$this->getParserOutputHelper(), |
|
36
|
|
|
$this->getNestingController() |
|
37
|
|
|
) |
|
38
|
|
|
); |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* @param string $input |
|
43
|
|
|
* @param array $arguments |
|
44
|
|
|
* @param string $expectedOutput |
|
45
|
|
|
* |
|
46
|
|
|
* @dataProvider placeMeArgumentsProvider |
|
47
|
|
|
* @throws MWException |
|
48
|
|
|
*/ |
|
49
|
|
|
public function testCanRender( $input, $arguments, $expectedOutput ) { |
|
50
|
|
|
$instance = new Jumbotron( |
|
51
|
|
|
$this->getComponentLibrary(), |
|
52
|
|
|
$this->getParserOutputHelper(), |
|
53
|
|
|
$this->getNestingController() |
|
54
|
|
|
); |
|
55
|
|
|
|
|
56
|
|
|
$parserRequest = $this->buildParserRequest( $input, $arguments ); |
|
57
|
|
|
|
|
58
|
|
|
/** @noinspection PhpParamsInspection */ |
|
59
|
|
|
$generatedOutput = $instance->parseComponent( $parserRequest ); |
|
60
|
|
|
|
|
61
|
|
|
$this->assertEquals( $expectedOutput, $generatedOutput ); |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
/** |
|
65
|
|
|
* @return array |
|
66
|
|
|
*/ |
|
67
|
|
|
public function placeMeArgumentsProvider() { |
|
68
|
|
|
return [ |
|
69
|
|
|
'simple' => [ |
|
70
|
|
|
$this->input, |
|
71
|
|
|
[], |
|
72
|
|
|
'<div class="container"><div class="jumbotron" id="bsc_jumbotron_NULL">' . $this->input . '</div></div>', |
|
73
|
|
|
], |
|
74
|
|
|
'manual id' => [ |
|
75
|
|
|
$this->input, |
|
76
|
|
|
[ 'id' => 'hms_dortmunder' ], |
|
77
|
|
|
'<div class="container"><div class="jumbotron" id="hms_dortmunder">' . $this->input . '</div></div>', |
|
78
|
|
|
], |
|
79
|
|
|
'style and class' => [ |
|
80
|
|
|
$this->input, |
|
81
|
|
|
[ 'class' => 'dummy nice', 'style' => 'float:right;background-color:green' ], |
|
82
|
|
|
'<div class="container"><div class="jumbotron dummy nice" style="float:right;background-color:green" id="bsc_jumbotron_NULL">' . $this->input . '</div></div>', |
|
83
|
|
|
], |
|
84
|
|
|
]; |
|
85
|
|
|
} |
|
86
|
|
|
} |
|
87
|
|
|
|