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

InstallCommandTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 79
Duplicated Lines 87.34 %

Coupling/Cohesion

Components 1
Dependencies 5

Importance

Changes 5
Bugs 1 Features 0
Metric Value
wmc 4
c 5
b 1
f 0
lcom 1
cbo 5
dl 69
loc 79
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A testInstallCommand() 16 16 1
A testInstallDevCommand() 18 18 1
A testInstallNoAnsiCommand() 17 17 1
A testInstallUseVendorPublishCommand() 18 18 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

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