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 PHPUnit\Framework\TestCase; |
||
6 | use Symfony\Component\Console\Application; |
||
7 | use Symfony\Component\DependencyInjection\ContainerInterface; |
||
8 | use Symfony\Component\Console\Tester\CommandTester; |
||
9 | |||
10 | class YumlCommandTest extends TestCase |
||
11 | { |
||
12 | const YUML_LINK = 'https://yuml.me/15a98c92.png'; |
||
13 | |||
14 | /** |
||
15 | * @var Application |
||
16 | */ |
||
17 | private $application; |
||
18 | |||
19 | /** |
||
20 | * @var YumlCommand |
||
21 | */ |
||
22 | private $command; |
||
23 | |||
24 | /** |
||
25 | * @var ContainerInterface |
||
26 | */ |
||
27 | private $container; |
||
28 | |||
29 | /** |
||
30 | * @var CommandTester |
||
31 | */ |
||
32 | private $commandTester; |
||
33 | |||
34 | public function setUp() |
||
35 | { |
||
36 | parent::setUp(); |
||
37 | |||
38 | $this->application = new Application(); |
||
39 | $this->application->add(new YumlCommand()); |
||
40 | $this->command = $this->application->find('yuml:mappings'); |
||
41 | |||
42 | $yumlClient = $this->createMock('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->createMock('Symfony\\Component\\DependencyInjection\\ContainerInterface'); |
||
0 ignored issues
–
show
|
|||
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) { |
||
62 | switch ($arg) { |
||
63 | case 'onurb_yuml.show_fields_description': |
||
64 | return false; |
||
65 | case 'onurb_yuml.colors': |
||
66 | case 'onurb_yuml.notes': |
||
67 | return array(); |
||
68 | default: |
||
69 | return false; |
||
70 | } |
||
71 | } |
||
72 | ) |
||
73 | ); |
||
74 | |||
75 | $this->command->setContainer($this->container); |
||
76 | |||
77 | $this->commandTester = new CommandTester($this->command); |
||
78 | } |
||
79 | |||
80 | /** |
||
81 | * @covers \Onurb\Bundle\YumlBundle\Command\YumlCommand |
||
82 | */ |
||
83 | public function testExecute() |
||
84 | { |
||
85 | $this->commandTester->execute(array( |
||
86 | 'command' => $this->command->getName() |
||
87 | )); |
||
88 | |||
89 | $this->assertRegExp('/.../', $this->commandTester->getDisplay()); |
||
90 | $this->assertSame('Downloaded', explode(' ', $this->commandTester->getDisplay())[0]); |
||
91 | } |
||
92 | } |
||
93 |
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..