These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace OnurbTest\Bundle\YumlBundle\Controller; |
||
4 | |||
5 | use Onurb\Bundle\YumlBundle\Controller\YumlController; |
||
6 | use PHPUnit\Framework\TestCase; |
||
7 | use Symfony\Component\DependencyInjection\ContainerInterface; |
||
8 | use Symfony\Component\HttpFoundation\RedirectResponse; |
||
9 | |||
10 | class YumlControllerTest extends TestCase |
||
11 | { |
||
12 | /** |
||
13 | * @var ContainerInterface |
||
14 | */ |
||
15 | protected $container; |
||
16 | |||
17 | /** |
||
18 | * @var string |
||
19 | */ |
||
20 | protected $controllerName = 'Onurb\\Bundle\\YumlBundle\\Controller\\YumlController'; |
||
21 | |||
22 | /** |
||
23 | * @covers \Onurb\Bundle\YumlBundle\Controller\YumlController |
||
24 | */ |
||
25 | public function testIndexAction() |
||
26 | { |
||
27 | $yumlClient = $this->createMock('Onurb\\Bundle\\YumlBundle\\Yuml\\YumlClientInterface'); |
||
28 | |||
29 | $yumlClient->expects($this->once()) |
||
30 | ->method('makeDslText') |
||
31 | ->will($this->returnValue('[Simple.Entity|+a;b;c]')); |
||
32 | |||
33 | $yumlClient->expects($this->once()) |
||
34 | ->method('getGraphUrl') |
||
35 | ->will($this->returnValue('https://yuml.me/15a98c92.png')); |
||
36 | |||
37 | $this->container = $this->createMock('Symfony\\Component\\DependencyInjection\\ContainerInterface'); |
||
0 ignored issues
–
show
|
|||
38 | |||
39 | $this->container->expects($this->once())->method('get') |
||
40 | ->with($this->matches('onurb_yuml.client')) |
||
41 | ->will($this->returnValue($yumlClient)); |
||
42 | |||
43 | $this->container->expects($this->any())->method('getParameter') |
||
44 | ->will( |
||
45 | $this->returnCallback( |
||
46 | function ($arg) { |
||
47 | switch ($arg) { |
||
48 | case 'onurb_yuml.show_fields_description': |
||
49 | return false; |
||
50 | case 'onurb_yuml.colors': |
||
51 | case 'onurb_yuml.notes': |
||
52 | return array(); |
||
53 | case 'onurb_yuml.extension': |
||
54 | return 'png'; |
||
55 | case 'onurb_yuml.style': |
||
56 | return 'plain'; |
||
57 | case 'onurb_yuml.direction': |
||
58 | return 'TB'; |
||
59 | case 'onurb_yuml.scale': |
||
60 | return 'normal'; |
||
61 | default: |
||
62 | return false; |
||
63 | } |
||
64 | } |
||
65 | ) |
||
66 | ); |
||
67 | |||
68 | $controller = $this->createController(); |
||
69 | |||
70 | $response = $controller->indexAction(); |
||
71 | |||
72 | $this->assertTrue($response instanceof RedirectResponse); |
||
73 | } |
||
74 | |||
75 | protected function createController() |
||
76 | { |
||
77 | /** |
||
78 | * @var YumlController $controller |
||
79 | */ |
||
80 | $controller = new $this->controllerName; |
||
81 | $controller->setContainer($this->container); |
||
82 | |||
83 | return($controller); |
||
84 | } |
||
85 | } |
||
86 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..