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

testItCreatesASeederFile()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 7

Duplication

Lines 9
Ratio 100 %

Importance

Changes 0
Metric Value
dl 9
loc 9
rs 9.6666
c 0
b 0
f 0
cc 1
eloc 7
nc 1
nop 0
1
<?php
2
3
4
use App\Lib\Helpers\TextFormatter;
5
use App\Lib\Slime\Console\Commands\CreateSeederCommand;
6
7 View Code Duplication
class CreateSeederCommandTest 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...
8
{
9
    private $name = 'test_seeder';
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...
10
    private $seederPath = 'database/seeds/';
11
    private $filesCreated = [];
12
13
    public function tearDown()
14
    {
15
        foreach ($this->filesCreated as $file) {
16
            unlink($file);
17
        }
18
    }
19
20
    /**
21
     * @group Novice
22
     * @group Commands
23
     * @group CreateSeeder
24
     */
25
    public function testItCreatesASeederFile()
26
    {
27
        $command = new CreateSeederCommand([$this->name]);
28
        $result = $command->run();
29
        $this->assertEquals(0, $result);
30
        $files = glob($this->seederPath . '*' . TextFormatter::snakeToCamelCase($this->name) . '.php');
31
        $this->assertNotEmpty($files);
32
        $this->filesCreated = array_merge($this->filesCreated, $files);
33
    }
34
35
}
36