Completed
Push — master ( 9ff25d...a4e20e )
by Nicolas
06:59
created

ModuleGeneratorTest::setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
rs 9.4285
cc 1
eloc 4
nc 1
nop 0
1
<?php
2
3
namespace Nwidart\Modules\Tests;
4
5
class ModuleGeneratorTest extends BaseTestCase
6
{
7
    /**
8
     * @var \Illuminate\Filesystem\Filesystem
9
     */
10
    private $finder;
11
    /**
12
     * @var string
13
     */
14
    private $modulePath;
15
16
    public function setUp()
17
    {
18
        parent::setUp();
19
        $this->modulePath = base_path('modules/Blog');
20
        $this->finder = $this->app['files'];
21
    }
22
23
    public function tearDown()
24
    {
25
        $this->finder->deleteDirectory($this->modulePath);
26
        parent::tearDown();
27
    }
28
29
    /** @test */
30
    public function it_generates_module()
31
    {
32
        $code = $this->artisan('module:make', ['name' => ['Blog']]);
33
34
        $this->assertTrue(is_dir($this->modulePath));
35
        $this->assertSame(0, $code);
36
    }
37
38
    /** @test */
39
    public function it_generates_module_folders()
40
    {
41
        $this->artisan('module:make', ['name' => ['Blog']]);
42
43
        foreach (config('modules.paths.generator') as $directory) {
44
            $this->assertTrue(is_dir($this->modulePath . '/' . $directory));
45
        }
46
    }
47
48
    /** @test */
49
    public function it_generates_module_files()
50
    {
51
        $this->artisan('module:make', ['name' => ['Blog']]);
52
53
        foreach (config('modules.stubs.files') as $file) {
54
            $this->assertTrue(is_file($this->modulePath . '/' . $file));
55
        }
56
    }
57
}
58