CreateComponentTest::testInitComponent()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 9
rs 10
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
}