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

AssetSourceTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A data_check() 0 6 1
A test_check() 0 8 1
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
}