Failed Conditions
Branch feature/refactoring-samurai (8cc7c1)
by Giuliano
03:49
created

CreateIncluderTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 12
dl 0
loc 25
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testCreateIncluder() 0 10 1
A testExistingIncluder() 0 11 1
1
<?php
2
3
namespace Maestriam\Samurai\Tests\Feature\Facade;
4
5
use Maestriam\Samurai\Exceptions\DirectiveExistsException;
6
use Maestriam\Samurai\Support\Samurai;
7
use Maestriam\Samurai\Tests\TestCase;
8
9
class CreateIncluderTest extends TestCase
10
{
11
    public function testCreateIncluder()
12
    {
13
        $theme = 'bands/rainbow';
14
        $name  = 'musics/lady-of-the-lake';
15
16
        $this->theme($theme)->findOrCreate();
17
18
        $includer = Samurai::theme($theme)->include($name)->create();
0 ignored issues
show
Bug introduced by
The method theme() does not exist on Maestriam\Samurai\Support\Samurai. Since you implemented __callStatic, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

18
        $includer = Samurai::/** @scrutinizer ignore-call */ theme($theme)->include($name)->create();
Loading history...
19
20
        $this->assertValidIncluder($includer);
21
    }
22
23
    public function testExistingIncluder()
24
    {
25
        $theme = 'bands/rainbow';
26
        $name  = 'musics/lady-of-the-lake';
27
28
        $this->theme($theme)->findOrCreate();
29
30
        $this->expectException(DirectiveExistsException::class);
31
32
        $includer1 = Samurai::theme($theme)->include($name)->create();
0 ignored issues
show
Unused Code introduced by
The assignment to $includer1 is dead and can be removed.
Loading history...
33
        $includer2 = Samurai::theme($theme)->include($name)->create();
0 ignored issues
show
Unused Code introduced by
The assignment to $includer2 is dead and can be removed.
Loading history...
34
    }
35
}