Code Duplication    Length = 29-29 lines in 4 locations

tests/CreateConfigCommandTest.php 1 location

@@ 5-33 (lines=29) @@
2
3
use App\Lib\Slime\Console\Commands\CreateConfigCommand;
4
5
class CreateConfigCommandTest extends PHPUnit_Framework_TestCase
6
{
7
    private $name = 'testConfig';
8
    private $configPath = 'config/';
9
    private $filesCreated = [];
10
11
    public function tearDown()
12
    {
13
        foreach ($this->filesCreated as $file) {
14
            unlink($file);
15
        }
16
    }
17
18
    /**
19
     * @group Novice
20
     * @group Commands
21
     * @group CreateConfig
22
     */
23
    public function testItCreatesAConfigFile()
24
    {
25
        $command = new CreateConfigCommand([$this->name]);
26
        $result = $command->run();
27
        $this->assertEquals(0, $result);
28
        $files = glob($this->configPath . $this->name . '.php');
29
        $this->assertNotEmpty($files);
30
        $this->filesCreated = array_merge($this->filesCreated, $files);
31
    }
32
33
}
34

tests/CreateMigrationCommandTest.php 1 location

@@ 7-35 (lines=29) @@
4
use App\Lib\Helpers\TextFormatter;
5
use App\Lib\Slime\Console\Commands\CreateMigrationCommand;
6
7
class CreateMigrationCommandTest extends PHPUnit_Framework_TestCase
8
{
9
    private $name = 'test_migration';
10
    private $migrationPath = 'database/migrations/';
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 CreateMigration
24
     */
25
    public function testItCreatesAMigrationFile()
26
    {
27
        $command = new CreateMigrationCommand([$this->name]);
28
        $result = $command->run();
29
        $this->assertEquals(0, $result);
30
        $files = glob($this->migrationPath . '*' . TextFormatter::snakeToCamelCase($this->name) . '.php');
31
        $this->assertNotEmpty($files);
32
        $this->filesCreated = array_merge($this->filesCreated, $files);
33
    }
34
35
}
36

tests/CreateModelCommandTest.php 1 location

@@ 6-34 (lines=29) @@
3
use App\Lib\Helpers\TextFormatter;
4
use App\Lib\Slime\Console\Commands\CreateModelCommand;
5
6
class CreateModelCommandTest extends PHPUnit_Framework_TestCase
7
{
8
    private $name = 'model';
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

tests/CreateSeederCommandTest.php 1 location

@@ 7-35 (lines=29) @@
4
use App\Lib\Helpers\TextFormatter;
5
use App\Lib\Slime\Console\Commands\CreateSeederCommand;
6
7
class CreateSeederCommandTest extends PHPUnit_Framework_TestCase
8
{
9
    private $name = 'test_seeder';
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