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

YumlControllerTest::createController()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 0
1
<?php
2
3
namespace OnurbTest\Bundle\YumlBundle\Controller;
4
5
use Onurb\Bundle\YumlBundle\Controller\YumlController;
6
7
use Symfony\Component\DependencyInjection\ContainerInterface;
8
use Symfony\Component\HttpFoundation\RedirectResponse;
9
10
class YumlControllerTest extends \PHPUnit_Framework_TestCase
11
{
12
13
    /**
14
     * @var ContainerInterface
15
     */
16
    protected $container;
17
18
    /**
19
     * @var string
20
     */
21
    protected $controllerName = 'Onurb\\Bundle\\YumlBundle\\Controller\\YumlController';
22
23
    /**
24
     * @covers \Onurb\Bundle\YumlBundle\Controller\YumlController
25
     */
26
    public function testIndexAction()
27
    {
28
        $yumlClient = $this->getMock('Onurb\\Bundle\\YumlBundle\\Yuml\\YumlClientInterface');
29
30
        $yumlClient->expects($this->once())
31
            ->method('makeDslText')
32
            ->will($this->returnValue('[Simple.Entity|+a;b;c]'));
33
34
        $yumlClient->expects($this->once())
35
            ->method('getGraphUrl')
36
            ->will($this->returnValue('http://yuml.me/15a98c92.png'));
37
38
        $this->container = $this->getMock('Symfony\\Component\\DependencyInjection\\ContainerInterface');
39
40
        $this->container->expects($this->any())->method('get')
41
            ->with($this->matches('onurb_yuml.client'))
42
            ->will($this->returnValue($yumlClient));
43
44
        $this->container->expects($this->any())->method('getParameter')
45
            ->will(
46
                $this->returnCallback(
47
                    function($arg) {
0 ignored issues
show
Coding Style introduced by
Expected 1 space after FUNCTION keyword; 0 found
Loading history...
48
                        switch ($arg) {
49
                            case 'onurb_yuml.show_fields_description':
50
                                return false;
51
                                break;
0 ignored issues
show
Unused Code introduced by
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...
52
                            case 'onurb_yuml.colors':
53
                            case 'onurb_yuml.notes':
54
                                return array();
55
                                break;
0 ignored issues
show
Unused Code introduced by
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...
56
                            default:
57
                                return false;
58
                        }
59
                    }
60
                )
61
            );
62
63
        $controller = $this->createController();
64
65
        $response = $controller->indexAction();
66
67
        //On teste si la r�ponse est bien une redirection.
68
        $this->assertTrue($response instanceof RedirectResponse);
69
    }
70
71
    protected function createController()
72
    {
73
        /**
74
         * @var \Onurb\Bundle\YumlBundle\Controller\YumlController $controller
75
         */
76
        $controller = new $this->controllerName;
77
        $controller->setContainer($this->container);
78
79
        return($controller);
80
    }
81
}
82