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 Kunstmaan\GeneratorBundle\Tests\Generator; |
||
4 | |||
5 | use Kunstmaan\GeneratorBundle\Generator\DefaultSiteGenerator; |
||
6 | use Kunstmaan\GeneratorBundle\Helper\CommandAssistant; |
||
7 | use PHPUnit\Framework\TestCase; |
||
8 | use Symfony\Component\Filesystem\Filesystem; |
||
9 | use Symfony\Component\HttpKernel\Kernel; |
||
10 | |||
11 | class DefaultSiteGeneratorTest extends TestCase |
||
12 | { |
||
13 | public function testGenerator() |
||
14 | { |
||
15 | $filesystem = new Filesystem(); |
||
16 | $path = sys_get_temp_dir() . '/' . uniqid(); |
||
17 | $filesystem->remove($path); |
||
18 | |||
19 | $bundle = $this->getBundle($path); |
||
20 | $container = $this->createMock('Symfony\Component\DependencyInjection\Container'); |
||
21 | $container |
||
22 | ->expects($this->any()) |
||
23 | ->method('getParameter') |
||
24 | ->will($this->returnValueMap([['multilanguage', true], ['kernel.project_dir', $path]])) |
||
25 | ; |
||
26 | $container |
||
27 | ->expects($this->any()) |
||
28 | ->method('hasParameter') |
||
29 | ->with('multilanguage') |
||
30 | ->will($this->returnValue(true)) |
||
31 | ; |
||
32 | |||
33 | $generator = new DefaultSiteGenerator($filesystem, $this->getRegistry(), '/defaultsite', $this->getAssistant(), $container); |
||
0 ignored issues
–
show
$container is of type object<PHPUnit\Framework\MockObject\MockObject> , but the function expects a null|object<Symfony\Comp...ion\ContainerInterface> .
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
Loading history...
|
|||
34 | $generator->generate($bundle, '', __DIR__ . '/../../_data', false); |
||
0 ignored issues
–
show
$bundle is of type object<PHPUnit\Framework\MockObject\MockObject> , but the function expects a object<Symfony\Component...Bundle\BundleInterface> .
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
Loading history...
|
|||
35 | |||
36 | $basePath = Kernel::VERSION_ID >= 40000 ? 'templates/bundles/' : 'app/Resources/'; |
||
37 | unlink(__DIR__ . '/../../_data/' . $basePath . 'TwigBundle/views/Exception/error.html.twig'); |
||
38 | unlink(__DIR__ . '/../../_data/' . $basePath . 'TwigBundle/views/Exception/error404.html.twig'); |
||
39 | unlink(__DIR__ . '/../../_data/' . $basePath . 'TwigBundle/views/Exception/error500.html.twig'); |
||
40 | unlink(__DIR__ . '/../../_data/' . $basePath . 'TwigBundle/views/Exception/error503.html.twig'); |
||
41 | } |
||
42 | |||
43 | protected function getBundle($path) |
||
44 | { |
||
45 | $bundle = $this->createMock('Symfony\Component\HttpKernel\Bundle\BundleInterface'); |
||
46 | $bundle |
||
47 | ->expects($this->any()) |
||
48 | ->method('getNamespace') |
||
49 | ->will($this->returnValue('Kunstmaan\TestBundle')) |
||
50 | ; |
||
51 | |||
52 | $bundle |
||
53 | ->expects($this->any()) |
||
54 | ->method('getName') |
||
55 | ->will($this->returnValue('KunstmaanTestBundle')) |
||
56 | ; |
||
57 | |||
58 | $bundle |
||
59 | ->expects($this->any()) |
||
60 | ->method('getPath') |
||
61 | ->will($this->returnValue($path)) |
||
62 | ; |
||
63 | |||
64 | return $bundle; |
||
65 | } |
||
66 | |||
67 | protected function getRegistry() |
||
68 | { |
||
69 | $registry = $this->createMock('Symfony\Bridge\Doctrine\RegistryInterface'); |
||
70 | |||
71 | return $registry; |
||
72 | } |
||
73 | |||
74 | protected function getAssistant() |
||
75 | { |
||
76 | $output = $this->createMock('Symfony\Component\Console\Output\OutputInterface'); |
||
77 | |||
78 | $commandAssistant = new CommandAssistant(); |
||
79 | $commandAssistant->setOutput($output); |
||
80 | |||
81 | return $commandAssistant; |
||
82 | } |
||
83 | } |
||
84 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: