Completed
Push — master ( 95aedb...06e367 )
by Alexey
15:04
created

SweetAlert2AssetTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 2
c 0
b 0
f 0
lcom 1
cbo 3
dl 0
loc 16
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A testRegister() 0 13 2
1
<?php
2
3
namespace tests;
4
5
use dominus77\sweetalert2\assets\SweetAlert2Asset;
6
use yii\web\AssetBundle;
7
8
/**
9
 * Class SweetAlert2AssetTest
10
 * @package tests
11
 */
12
class SweetAlert2AssetTest extends TestCase
13
{
14
    public function testRegister()
15
    {
16
        $min = YII_ENV_DEV ? '' : '.min';
17
18
        $view = $this->getView();
19
        $this->assertEmpty($view->assetBundles);
20
        SweetAlert2Asset::register($view);
21
        $this->assertEquals(1, count($view->assetBundles));
22
        $this->assertTrue($view->assetBundles['dominus77\\sweetalert2\\assets\\SweetAlert2Asset'] instanceof AssetBundle);
23
        $content = $view->renderFile('@tests/views/layouts/rawlayout.php');
24
        $this->assertContains('sweetalert2' . $min . '.css', $content);
25
        $this->assertContains('sweetalert2' . $min . '.js', $content);
26
    }
27
}