AssetRendererTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 14
dl 0
loc 29
rs 10
c 1
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A test_for_styleWithContent() 0 7 1
A test_for_styleLink() 0 7 1
A test_for_script() 0 7 1
1
<?php
2
3
namespace ByTIC\Assets\Tests\Assets\Asset;
4
5
use ByTIC\Assets\Assets\Asset;
6
use ByTIC\Assets\Tests\AbstractTest;
7
8
/**
9
 * Class AssetRendererTest
10
 * @package ByTIC\Assets\Tests\Assets\Asset
11
 */
12
class AssetRendererTest extends AbstractTest
13
{
14
    public function test_for_styleLink()
15
    {
16
        $asset = new Asset('test.css', Asset::TYPE_STYLES);
17
        /** @noinspection HtmlUnknownTarget */
18
        self::assertSame(
19
            '<link href="test.css" type="text/css" rel="stylesheet" />',
20
            Asset\AssetRenderer::for($asset)
21
        );
22
    }
23
24
    public function test_for_styleWithContent()
25
    {
26
        $asset = new Asset('', Asset::TYPE_STYLES);
27
        $asset->setContent('p{color:#fff;}');
28
        self::assertSame(
29
            '<style type="text/css" rel="stylesheet">p{color:#fff;}</style>',
30
            Asset\AssetRenderer::for($asset)
31
        );
32
    }
33
34
    public function test_for_script()
35
    {
36
        $asset = new Asset('test.js', Asset::TYPE_SCRIPTS);
37
        /** @noinspection HtmlUnknownTarget */
38
        self::assertSame(
39
            '<script src="test.js"></script>',
40
            Asset\AssetRenderer::for($asset)
41
        );
42
    }
43
}
44