InstallCommandTest::testInstallDevCommand()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 17
Code Lines 11

Duplication

Lines 17
Ratio 100 %

Importance

Changes 2
Bugs 1 Features 0
Metric Value
c 2
b 1
f 0
dl 17
loc 17
rs 9.4285
cc 1
eloc 11
nc 1
nop 0
1
<?php
2
3
namespace Acacha\AdminLTETemplateLaravel\Tests;
4
5
use Acacha\AdminLTETemplateLaravel\Console\InstallCommand;
6
use PHPUnit\Framework\TestCase;
7
use Symfony\Component\Console\Application;
8
use Symfony\Component\Console\Tester\CommandTester;
9
10
/**
11
 * Class InstallCommandTest.
12
 */
13
class InstallCommandTest extends TestCase
14
{
15
    /** @test */
16
    public function testInstallCommand()
17
    {
18
        $application = new Application();
19
        $application->add(new InstallCommand());
20
21
        $command = $application->find('install');
22
        $commandTester = new CommandTester($command);
23
24
        $commandTester->execute([
25
            'command' => $command->getName(),
26
        ]);
27
28
        $output = $commandTester->getDisplay();
29
        $this->assertContains('Running composer require acacha/admin-lte-template-laravel', $output);
30
        $this->assertContains('php artisan adminlte:publish', $output);
31
        $this->assertContains('composer require --dev laravel/dusk', $output);
32
        $this->assertContains('php artisan dusk:install', $output);
33
    }
34
35
    /** @test */
36 View Code Duplication
    public function testInstallDevCommand()
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...
37
    {
38
        $application = new Application();
39
        $application->add(new InstallCommand());
40
41
        $command = $application->find('install');
42
        $commandTester = new CommandTester($command);
43
44
        $commandTester->execute([
45
            'command' => $command->getName(),
46
            '--dev'   => true,
47
        ]);
48
49
        $output = $commandTester->getDisplay();
50
        $this->assertContains('Running composer require acacha/admin-lte-template-laravel:dev-master', $output);
51
        $this->assertContains('php artisan adminlte:publish', $output);
52
    }
53
54
    /** @test */
55 View Code Duplication
    public function testInstallNoAnsiCommand()
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...
56
    {
57
        $application = new Application();
58
        $application->add(new InstallCommand());
59
60
        $command = $application->find('install');
61
        $commandTester = new CommandTester($command);
62
63
        $commandTester->execute([
64
            'command'   => $command->getName(),
65
            '--no-ansi' => true,
66
        ]);
67
68
        $output = $commandTester->getDisplay();
69
        $this->assertContains('--no-ansi', $output);
70
    }
71
}
72