1 | <?php |
||
12 | class AlertTest extends TestCase |
||
13 | { |
||
14 | /** |
||
15 | * getOptions() |
||
16 | */ |
||
17 | public function testGetOptions() |
||
18 | { |
||
19 | $alert = new Alert(); |
||
20 | $alert->options = [ |
||
21 | 'id' => 'test_id', |
||
22 | 'Any fool can use a computer' |
||
23 | ]; |
||
24 | $this->assertJson(Json::encode($alert->options), $alert->getOptions()); |
||
25 | } |
||
26 | |||
27 | public function testRegisterSwalQueue() |
||
28 | { |
||
29 | \Yii::$app->session->setFlash('success', 'Your message'); |
||
30 | $alert = Alert::widget(['useSessionFlash' => true]); |
||
31 | $this->assertContains('', $alert); |
||
32 | } |
||
33 | |||
34 | public function testRunFlash() |
||
35 | { |
||
36 | \Yii::$app->session->setFlash('success', [ |
||
37 | [ |
||
38 | 'title' => 'Your title', |
||
39 | 'message' => 'Your message', |
||
40 | 'animation' => false, |
||
41 | 'customClass' => 'animated jello', |
||
42 | ] |
||
43 | ]); |
||
44 | |||
45 | $alert = Alert::widget(['useSessionFlash' => true]); |
||
46 | $this->assertContains('', $alert); |
||
47 | } |
||
48 | |||
49 | public function testRegisterSwal() |
||
50 | { |
||
51 | $alert = Alert::widget([ |
||
52 | 'options' => [ |
||
53 | 'title' => 'Your title', |
||
54 | 'message' => 'Your message', |
||
55 | 'animation' => false, |
||
56 | 'customClass' => 'animated jello', // https://daneden.github.io/animate.css/ |
||
57 | ], |
||
58 | ]); |
||
59 | $this->assertContains('', $alert); |
||
60 | } |
||
61 | } |