Completed
Push — master ( 9fad7c...f2bd1d )
by Sergi Tur
13:32 queued 11s
created

InstallCommandTest::testInstallDevCommand()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 18
Code Lines 11

Duplication

Lines 18
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 18
loc 18
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 View Code Duplication
    public function testInstallCommand()
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...
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
    }
32
33
    /** @test */
34 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...
35
    {
36
        $application = new Application();
37
        $application->add(new InstallCommand());
38
39
        $command = $application->find('install');
40
        $commandTester = new CommandTester($command);
41
42
        $commandTester->execute([
43
            'command' => $command->getName(),
44
            '--dev' => true
45
        ]);
46
47
        $output = $commandTester->getDisplay();
48
        $this->assertContains('Running composer require acacha/admin-lte-template-laravel:dev-master', $output);
49
        $this->assertContains('php artisan adminlte:publish', $output);
50
51
    }
52
53
    /** @test */
54 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...
55
    {
56
        $application = new Application();
57
        $application->add(new InstallCommand());
58
59
        $command = $application->find('install');
60
        $commandTester = new CommandTester($command);
61
62
        $commandTester->execute([
63
            'command' => $command->getName(),
64
            '--no-ansi' => true
65
        ]);
66
67
        $output = $commandTester->getDisplay();
68
        $this->assertContains('--no-ansi', $output);
69
70
    }
71
72
    /** @test */
73 View Code Duplication
    public function testInstallUseVendorPublishCommand()
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...
74
    {
75
        $application = new Application();
76
        $application->add(new InstallCommand());
77
78
        $command = $application->find('install');
79
        $commandTester = new CommandTester($command);
80
81
        $commandTester->execute([
82
            'command' => $command->getName(),
83
            '--use-vendor-publish' => true
84
        ]);
85
86
        $output = $commandTester->getDisplay();
87
        $this->assertContains('Running composer require acacha/admin-lte-template-laravel', $output);
88
        $this->assertContains('php artisan vendor:publish --tag=adminlte --force', $output);
89
90
    }
91
}
92