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

InstallCommandTest::testExecute()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 73
Code Lines 28

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 1 Features 0
Metric Value
c 3
b 1
f 0
dl 0
loc 73
rs 9.0675
cc 1
eloc 28
nc 1
nop 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A InstallCommandTest::testInstallDevCommand() 18 18 1
A InstallCommandTest::testInstallNoAnsiCommand() 17 17 1
A InstallCommandTest::testInstallUseVendorPublishCommand() 18 18 1

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

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