Completed
Push — master ( c3eba2...34879d )
by amaury
05:12 queued 01:44
created

OrchestraUnpublishNodeCommandTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 39
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 5

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 5
dl 39
loc 39
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 7 7 1
A testExecute() 4 4 1
A provideSiteId() 6 6 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 OpenOrchestra\FunctionalTests\BackofficeBundle\Command;
4
5
use OpenOrchestra\BackofficeBundle\Command\OrchestraUnpublishNodeCommand;
6
use Symfony\Bundle\FrameworkBundle\Console\Application;
7
use OpenOrchestra\BaseBundle\Tests\AbstractTest\AbstractWebTestCase;
8
use OpenOrchestra\FunctionalTests\BackofficeBundle\Command\PublishElementCommandTrait;
9
10
/**
11
 * Class OrchestraUnpublishNodeCommandTest
12
 */
13 View Code Duplication
class OrchestraUnpublishNodeCommandTest extends AbstractWebTestCase
0 ignored issues
show
Duplication introduced by
This class 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...
14
{
15
    use PublishElementCommandTrait;
16
17
    protected $application;
18
19
    /**
20
     * Set Up
21
     */
22
    public function setUp()
23
    {
24
        $client = self::createClient();
25
        $this->application = new Application($client->getKernel());
26
        $this->application->setAutoExit(false);
27
        $this->application->add(new OrchestraUnpublishNodeCommand());
28
    }
29
30
    /**
31
     * Test the command
32
     *
33
     * @param string $siteId
34
     *
35
     * @dataProvider provideSiteId
36
     */
37
    public function testExecute($siteId)
38
    {
39
        $this->executeUnpublish($siteId, 'orchestra:unpublish:node', 'open_orchestra_model.repository.node', 'node');
40
    }
41
42
    /**
43
     * Provide site id
44
     */
45
    public function provideSiteId()
46
    {
47
        return array(
48
            array('2'),
49
        );
50
    }
51
}
52