GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 0165b3...f3e283 )
by Bruno
13:51
created

Bundle/YumlBundle/Command/YumlCommandTest.php (3 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
namespace OnurbTest\Bundle\YumlBundle\Command;
3
4
use Onurb\Bundle\YumlBundle\Command\YumlCommand;
5
use Symfony\Component\Console\Application;
6
use Symfony\Component\Console\Tester\CommandTester;
7
use Symfony\Component\DependencyInjection\ContainerInterface;
8
9
class YumlCommandTest extends \PHPUnit_Framework_TestCase
10
{
11
    const YUML_LINK = 'https://yuml.me/15a98c92.png';
12
13
    /**
14
     * @var Application
15
     */
16
    private $application;
17
18
    /**
19
     * @var YumlCommand
20
     */
21
    private $command;
22
23
    /**
24
     * @var ContainerInterface
25
     */
26
    private $container;
27
28
    /**
29
     * @var CommandTester
30
     */
31
    private $commandTester;
32
33
    public function setUp()
34
    {
35
        parent::setUp();
36
        $this->application = new Application();
37
        $this->application->add(new YumlCommand());
38
        $this->command = $this->application->find('yuml:mappings');
39
40
        $this->commandTester = new CommandTester($this->command);
41
42
        $yumlClient = $this->getMock('Onurb\\Bundle\\YumlBundle\\Yuml\\YumlClientInterface');
43
44
        $yumlClient->expects($this->once())
45
            ->method('makeDslText')
46
            ->will($this->returnValue('[Simple.Entity|+a;b;c]'));
47
48
        $yumlClient->expects($this->once())
49
            ->method('getGraphUrl')
50
            ->will($this->returnValue(self::YUML_LINK));
51
52
        $this->container = $this->getMock('Symfony\\Component\\DependencyInjection\\ContainerInterface');
53
54
        $this->container->expects($this->once())->method('get')
55
            ->with($this->matches('onurb_yuml.client'))
56
            ->will($this->returnValue($yumlClient));
57
58
        $this->container->expects($this->any())->method('getParameter')
59
            ->will(
60
                $this->returnCallback(
61
                    function($arg) {
0 ignored issues
show
Expected 1 space after FUNCTION keyword; 0 found
Loading history...
62
                        switch ($arg) {
63
                            case 'onurb_yuml.show_fields_description':
64
                                return false;
65
                                break;
0 ignored issues
show
break is not strictly necessary here and could be removed.

The break statement is not necessary if it is preceded for example by a return statement:

switch ($x) {
    case 1:
        return 'foo';
        break; // This break is not necessary and can be left off.
}

If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive.

Loading history...
66
                            case 'onurb_yuml.colors':
67
                            case 'onurb_yuml.notes':
68
                                return array();
69
                                break;
0 ignored issues
show
break is not strictly necessary here and could be removed.

The break statement is not necessary if it is preceded for example by a return statement:

switch ($x) {
    case 1:
        return 'foo';
        break; // This break is not necessary and can be left off.
}

If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive.

Loading history...
70
                            default:
71
                                return false;
72
                        }
73
                    }
74
                )
75
            );
76
77
        $this->command->setContainer($this->container);
78
    }
79
80
    /**
81
     * @covers \Onurb\Bundle\YumlBundle\Command\YumlCommand
82
     */
83
    public function testExecute()
84
    {
85
        $this->commandTester->execute(array('command' => $this->command->getName()));
86
        $this->assertRegExp('/.../', $this->commandTester->getDisplay());
87
        $this->assertSame('Downloaded', explode(' ', $this->commandTester->getDisplay())[0]);
88
    }
89
}
90