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

CreateRouteCommandTest::tearDown()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 7
rs 9.4285
cc 2
eloc 4
nc 2
nop 0
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