JavascriptProviderTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Importance

Changes 6
Bugs 0 Features 1
Metric Value
wmc 2
eloc 13
dl 0
loc 35
rs 10
c 6
b 0
f 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testGetJavascripts() 0 13 1
A test__construct() 0 8 1
1
<?php
2
3
/*
4
 * This file is part of the core-bundle package.
5
 *
6
 * (c) 2022 WEBEWEB
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace WBW\Bundle\CoreBundle\Tests\Provider;
13
14
use WBW\Bundle\CoreBundle\Provider\JavascriptProvider;
15
use WBW\Bundle\CoreBundle\Tests\AbstractTestCase;
16
use WBW\Library\Symfony\Provider\JavascriptProviderInterface;
17
use WBW\Library\Symfony\Provider\ProviderInterface;
18
19
/**
20
 * Javascript provider test.
21
 *
22
 * @author webeweb <https://github.com/webeweb>
23
 * @package WBW\Bundle\CoreBundle\Tests\Provider
24
 */
25
class JavascriptProviderTest extends AbstractTestCase {
26
27
    /**
28
     * Test getJavascripts()
29
     *
30
     * @return void
31
     */
32
    public function testGetJavascripts(): void {
33
34
        $obj = new JavascriptProvider();
35
36
        $exp = [
37
            "WBWCoreJQueryInputMask"            => "@WBWCore/assets/WBWCoreJQueryInputMask.js.twig",
38
            "WBWCoreLeaflet"                    => "@WBWCore/assets/WBWCoreLeaflet.js.twig",
39
            "WBWCoreMaterialDesignColorPalette" => "@WBWCore/assets/WBWCoreMaterialDesignColorPalette.js.twig",
40
            "WBWCoreSweetAlert"                 => "@WBWCore/assets/WBWCoreSweetAlert.js.twig",
41
            "WBWCoreWaitMe"                     => "@WBWCore/assets/WBWCoreWaitMe.js.twig",
42
        ];
43
44
        $this->assertEquals($exp, $obj->getJavascripts());
45
    }
46
47
    /**
48
     * Test __construct()
49
     *
50
     * @return void
51
     */
52
    public function test__construct(): void {
53
54
        $this->assertEquals("wbw.core.provider.javascript", JavascriptProvider::SERVICE_NAME);
55
56
        $obj = new JavascriptProvider();
57
58
        $this->assertInstanceOf(ProviderInterface::class, $obj);
59
        $this->assertInstanceOf(JavascriptProviderInterface::class, $obj);
60
    }
61
}
62