Completed
Push — master ( aba493...5356ed )
by Ruud
315:38 queued 305:00
created

PageTemplateConfigurationParserTest.php (2 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
3
namespace Kunstmaan\PagePartBundle\Tests\PagePartConfigurationReader;
4
5
use Kunstmaan\PagePartBundle\PageTemplate\PageTemplate;
6
use Kunstmaan\PagePartBundle\PageTemplate\PageTemplateConfigurationParser;
7
use PHPUnit\Framework\TestCase;
8
use Symfony\Component\HttpKernel\KernelInterface;
9
10
class PageTemplateConfigurationParserTest extends TestCase
11
{
12
    public function testParseSf4Flow()
13
    {
14
        $kernel = $this->createMock(KernelInterface::class);
15
        $pageTemplateConfigurationParser = new PageTemplateConfigurationParser($kernel, [
0 ignored issues
show
$kernel is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<Symfony\Component...Kernel\KernelInterface>.

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...
16
            'contentpage' => [
17
                'name' => 'Content page',
18
                'rows' => [
19
                    ['regions' => [['name' => 'main', 'span' => 12]]],
20
                ],
21
                'template' => 'Pages\\ContentPage\\pagetemplate.html.twig',
22
            ],
23
        ]);
24
25
        $result = $pageTemplateConfigurationParser->parse('contentpage');
26
        $this->assertInstanceOf(PageTemplate::class, $result);
27
        $this->assertEquals('Content page', $result->getName());
28
    }
29
30 View Code Duplication
    public function testParseSf3Flow()
31
    {
32
        $kernel = $this->createMock(KernelInterface::class);
33
        $kernel->method('locateResource')->willReturn(__DIR__ . '/Resources/config/pagetemplates/test.yml');
34
35
        $pageTemplateConfigurationParser = new PageTemplateConfigurationParser($kernel, []);
0 ignored issues
show
$kernel is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<Symfony\Component...Kernel\KernelInterface>.

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...
36
37
        $result = $pageTemplateConfigurationParser->parse('MyWebsiteBundle:test');
38
        $this->assertInstanceOf(PageTemplate::class, $result);
39
        $this->assertEquals('Test page', $result->getName());
40
    }
41
}
42