Completed
Push — stable ( 386c57...2cb6a4 )
by Nuno
02:05
created

DotenvInstallTest::tearDown()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace Tests;
4
5
use Illuminate\Support\Facades\File;
6
use Illuminate\Support\Facades\Artisan;
7
use LaravelZero\Framework\Contracts\Providers\Composer;
8
9
class DotenvInstallTest extends TestCase
10
{
11
    public function tearDown()
12
    {
13
        File::delete(base_path('.env'));
14
        File::delete(base_path('.env.example'));
15
    }
16
17
    /** @test */
18 View Code Duplication
    public function it_requires_packages(): void
0 ignored issues
show
Duplication introduced by
This method 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...
19
    {
20
        $composerMock = $this->createMock(Composer::class);
21
        $composerMock->expects($this->once())->method('require')->with('vlucas/phpdotenv');
22
        $this->app->instance(Composer::class, $composerMock);
23
24
        Artisan::call('app:install', ['component' => 'dotenv']);
25
    }
26
27
    /** @test */
28
    public function it_copy_stubs(): void
29
    {
30
        $composerMock = $this->createMock(Composer::class);
31
        $composerMock->expects($this->once())->method('require')->with('vlucas/phpdotenv');
32
        $this->app->instance(Composer::class, $composerMock);
33
34
        Artisan::call('app:install', ['component' => 'dotenv']);
35
36
        $this->assertTrue(File::exists(base_path('.env')));
37
        $this->assertTrue(File::exists(base_path('.env.example')));
38
    }
39
}
40