CreateComponentTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testInitComponent() 0 9 1
A testExistingComponent() 0 11 1
1
<?php
2
3
namespace Maestriam\Samurai\Tests\Unit\Entities\Component;
4
5
use Maestriam\Samurai\Entities\Component;
6
use Maestriam\Samurai\Entities\Theme;
7
use Maestriam\Samurai\Exceptions\DirectiveExistsException;
8
use Maestriam\Samurai\Tests\TestCase;
9
10
class CreateComponentTest extends TestCase
11
{
12
    public function testInitComponent()
13
    {
14
        $theme = new Theme('bands/metallica');
15
16
        $component = new Component($theme, 'integrants/hetfield');
17
18
        $file = $component->create();
19
20
        $this->assertFileExists($file->path());
21
    }
22
    
23
    public function testExistingComponent()
24
    {
25
        $theme = $this->theme('bands/metallica');
26
27
        $component1 = new Component($theme, 'integrants/kirk');
28
        $component2 = new Component($theme, 'integrants/kirk');
29
30
        $this->expectException(DirectiveExistsException::class);
31
32
        $component1->create();
33
        $component2->create();
34
    }
35
}