Completed
Push — master ( ed4843...c0d0bb )
by Vincenzo
02:12
created

CreateModelCommandTest::tearDown()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 6
Ratio 100 %

Importance

Changes 0
Metric Value
dl 6
loc 6
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 3
nc 2
nop 0
1
<?php
2
3
use App\Lib\Helpers\TextFormatter;
4
use App\Lib\Slime\Console\Commands\CreateModelCommand;
5
6 View Code Duplication
class CreateModelCommandTest extends PHPUnit_Framework_TestCase
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
7
{
8
    private $name = 'model';
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...
9
    private $modelPath = 'Models/';
10
    private $filesCreated = [];
11
12
    public function tearDown()
13
    {
14
        foreach ($this->filesCreated as $file) {
15
            unlink($file);
16
        }
17
    }
18
19
    /**
20
     * @group Novice
21
     * @group Commands
22
     * @group CreateModel
23
     */
24
    public function testItCreatesAModelFile()
25
    {
26
        $command = new CreateModelCommand([$this->name]);
27
        $result = $command->run();
28
        $this->assertEquals(0, $result);
29
        $files = glob($this->modelPath . TextFormatter::snakeToCamelCase($this->name) . '.php');
30
        $this->assertNotEmpty($files);
31
        $this->filesCreated = array_merge($this->filesCreated, $files);
32
    }
33
34
}
35