Completed
Push — master ( 57a663...a35231 )
by Iulian
02:48
created

elixirFunctionThrowsErrorWhenFileNotExists()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 7
rs 9.4285
cc 1
eloc 5
nc 1
nop 0
1
<?php
2
3
namespace Iulyanp\ElixirMixBundle\Tests\Twig;
4
5
use Iulyanp\ElixirMixBundle\Twig\MixExtension;
6
7
/**
8
 * Class Test
9
 */
10
class ElixirMixExtensionTest extends \PHPUnit_Framework_TestCase
11
{
12
    const WEB_DIR = __DIR__.'/stub';
13
14
    /**
15
     * @var
16
     */
17
    private $mixExtension;
18
19
    /**
20
     * Set UP.
21
     *
22
     * Instantiate ElixirExtension for all tests
23
     */
24
    public function setUp()
25
    {
26
        $this->mixExtension = new MixExtension(self::WEB_DIR);
27
    }
28
29
    /**
30
     * @test
31
     */
32
    public function mixFunctionReturnManifest()
33
    {
34
        $this->assertEquals(
35
            'css/app-db9165hf67.css',
36
            $this->mixExtension->mix('app.css')
37
        );
38
        $this->assertEquals(
39
            'css/index-9rt53c9u67.css',
40
            $this->mixExtension->mix('index.css')
41
        );
42
        $this->assertEquals(
43
            'js/app-db9183c967.js',
44
            $this->mixExtension->mix('app.js')
45
        );
46
    }
47
48
    /**
49
     * @test
50
     */
51
    public function elixirFunctionThrowsErrorWhenFileNotExists()
52
    {
53
        $this->expectException('\Exception');
54
        $this->expectExceptionMessage('The "css/not_existing.css" key could not be found in the manifest file. '.
55
        'Please pass just the asset filename as a parameter to the mix() method.');
56
        $this->mixExtension->mix('css/not_existing.css');
57
    }
58
}
59