Completed
Push — master ( d38b33...d045d3 )
by Vincenzo
02:36
created

CreateRouteCommandTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
c 0
b 0
f 0
lcom 1
cbo 2
dl 0
loc 30
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A tearDown() 0 7 2
A testItCreatesARouteFile() 0 9 1
1
<?php
2
3
use App\Lib\Slime\Console\Commands\CreateRouteCommand;
4
5
class CreateRouteCommandTest extends PHPUnit_Framework_TestCase
6
{
7
    private $name = 'testentity';
0 ignored issues
show
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
8
    private $routesPath = 'routes/';
9
    private $filesCreated = [];
10
11
    public function tearDown()
12
    {
13
        foreach ($this->filesCreated as $file) {
14
            unlink($file);
15
        }
16
        rmdir($this->routesPath . $this->name);
17
    }
18
19
    /**
20
     * @group Novice
21
     * @group Commands
22
     * @group CreateRoute
23
     */
24
    public function testItCreatesARouteFile()
25
    {
26
        $command = new CreateRouteCommand([$this->name]);
27
        $result = $command->run();
28
        $this->assertEquals(0, $result);
29
        $files = glob($this->routesPath . $this->name . '/routes.php');
30
        $this->assertNotEmpty($files);
31
        $this->filesCreated = array_merge($this->filesCreated, $files);
32
    }
33
34
}
35