Passed
Push — master ( 736032...f19203 )
by Gabriel
04:19 queued 30s
created

AssetSourceTest::test_check()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 5
c 1
b 0
f 1
nc 1
nop 3
dl 0
loc 8
rs 10
1
<?php
2
3
namespace ByTIC\Assets\Tests\Assets\Asset;
4
5
use ByTIC\Assets\Assets\Asset;
6
use ByTIC\Assets\Assets\Asset\AssetSource;
7
use ByTIC\Assets\Tests\AbstractTest;
8
9
/**
10
 * Class AssetSourceTest
11
 * @package ByTIC\Assets\Tests\Assets\Asset
12
 */
13
class AssetSourceTest extends AbstractTest
14
{
15
    /**
16
     * @dataProvider data_check
17
     * @param $source
18
     * @param $type
19
     * @param $output
20
     */
21
    public function test_check($source, $type, $output)
22
    {
23
        $mock = \Mockery::mock(AssetSource::class)->shouldAllowMockingProtectedMethods()->makePartial();
24
        $mock->shouldReceive('transformSourceWithAsset')->andReturnUsing(function ($argument) {
25
            return '/assets'.$argument;
26
        });
27
        $source = $mock->buildSource($source, $type);
28
        self::assertSame($output, $source);
29
    }
30
31
    /**
32
     * @return array[]
33
     */
34
    public function data_check()
35
    {
36
        return [
37
            ['test.css', Asset::TYPE_STYLES, 'test.css'],
38
            ['test', Asset::TYPE_STYLES, '/assets/stylesheets/test.css'],
39
            ['test', Asset::TYPE_SCRIPTS, '/assets/scripts/test.js'],
40
        ];
41
    }
42
}