Total Complexity | 2 |
Total Lines | 46 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
14 | final class AlertTest extends TestCase |
||
15 | { |
||
16 | public function testNormalAlert(): void |
||
17 | { |
||
18 | Alert::counter(0); |
||
19 | |||
20 | $html = Alert::widget() |
||
21 | ->body('<strong>Holy guacamole!</strong> You should check in on some of those fields below.') |
||
22 | ->options([ |
||
23 | 'class' => ['alert-warning'] |
||
24 | ]) |
||
25 | ->render(); |
||
26 | |||
27 | $expectedHtml = <<<HTML |
||
28 | <div id="w0-alert" class="alert-warning alert alert-dismissible" role="alert"> |
||
29 | |||
30 | <strong>Holy guacamole!</strong> You should check in on some of those fields below. |
||
31 | <button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">×</span></button> |
||
32 | |||
33 | </div> |
||
34 | HTML; |
||
35 | |||
36 | $this->assertEqualsWithoutLE($expectedHtml, $html); |
||
37 | } |
||
38 | |||
39 | /** |
||
40 | * @depends testNormalAlert |
||
41 | */ |
||
42 | public function testDismissibleAlert(): void |
||
43 | { |
||
44 | Alert::counter(0); |
||
45 | |||
46 | $html = Alert::widget() |
||
47 | ->body("Message1") |
||
48 | ->render(); |
||
49 | |||
50 | $expectedHtml = <<<HTML |
||
51 | <div id="w0-alert" class="alert alert-dismissible" role="alert"> |
||
52 | |||
53 | Message1 |
||
54 | <button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">×</span></button> |
||
55 | |||
56 | </div> |
||
57 | HTML; |
||
58 | |||
59 | $this->assertEqualsWithoutLE($expectedHtml, $html); |
||
60 | } |
||
62 |