Completed
Push — master ( a5a038...08ae9a )
by Ricardo
04:34
created

ProjectNotifyPushCommandTest::tearDown()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Fabrica\Bundle\CoreBundle\Tests\Command;
4
5
use Fabrica\Bundle\CoreBundle\Test\CommandTestCase;
6
7
class ProjectNotifyPushCommandTest extends CommandTestCase
8
{
9
    protected $client;
10
11
    protected function setUp(): void
12
    {
13
        $this->client = self::createClient();
14
        $this->client->startIsolation();
15
    }
16
17
    public function tearDown(): void
18
    {
19
        $this->client->stopIsolation();
20
    }
21
22 View Code Duplication
    public function testSimpleCase()
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...
23
    {
24
        list($statusCode, $output) = $this->execCommand('foobar', 'alice', '/refs/heads/master', 'd8930cd3f7e343195b85d56408a701feb98b95a8', '026537944abd3c0498b30e6d10916a64fe0988c4');
25
26
        $this->assertEquals(0, $statusCode);
27
        $this->assertEquals(null, $output);
28
    }
29
30
    public function testUndefinedProjectCase()
31
    {
32
        list($statusCode, $output) = $this->execCommand('example', 'alice', '/refs/heads/master', '0', '0');
33
34
        $this->assertEquals(1, $statusCode);
35
        $this->assertEquals(null, $output);
36
    }
37
38 View Code Duplication
    public function testNewReferenceCase()
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...
39
    {
40
        list($statusCode, $output) = $this->execCommand('foobar', 'alice', '/refs/heads/example', 'd8930cd3f7e343195b85d56408a701feb98b95a8', '026537944abd3c0498b30e6d10916a64fe0988c4');
41
42
        $this->assertEquals(0, $statusCode);
43
        $this->assertEquals(null, $output);
44
    }
45
46 View Code Duplication
    public function testUndefinedUserCase()
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...
47
    {
48
        list($statusCode, $output) = $this->execCommand('foobar', 'example', '/refs/heads/master', 'd8930cd3f7e343195b85d56408a701feb98b95a8', '026537944abd3c0498b30e6d10916a64fe0988c4');
49
50
        $this->assertEquals(1, $statusCode);
51
        $this->assertEquals(null, $output);
52
    }
53
54
    public function execCommand($project, $user, $reference, $before, $after)
55
    {
56
        return $this->runCommand(
57
            $this->client, sprintf(
58
                'fabrica:project-notify-push %s %s %s %s %s',
59
                $project, $user, $reference, $before, $after
60
            )
61
        );
62
    }
63
}
64