Passed
Push — main ( 4ba462...bcb2e0 )
by Mohammad
03:01
created

UngenerateFilesTest::setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 4
rs 10
1
<?php
2
3
namespace Shamaseen\Repository\Tests\Feature;
4
5
use Shamaseen\Repository\PathResolver;
6
use Shamaseen\Repository\Tests\TestCase;
7
8
class UngenerateFilesTest extends TestCase
9
{
10
    private array $filesToGenerate = ['Controller', 'Repository', 'Model', 'Request', 'Resource', 'Collection', 'Policy', 'Test'];
11
12
    protected string $modelName = 'Test';
13
    protected string $userPath = 'Tests';
14
15
    /**
16
     * @param string $dataName
17
     */
18
    public function __construct(?string $name = null, array $data = [], $dataName = '')
19
    {
20
        parent::__construct($name, $data, $dataName);
21
    }
22
23
    public function testUngenerate()
24
    {
25
        $this->artisan("ungenerate:repository $this->userPath/$this->modelName")
26
            ->expectsConfirmation('This will delete Test files and folder, Do you want to continue ?', 'yes');
27
28
        foreach ($this->filesToGenerate as $type) {
29
            $outputPath = $this->generator->absolutePath($this->pathResolver->outputPath($type));
30
            $this->assertFileDoesNotExist($outputPath);
31
        }
32
    }
33
}
34