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

testParseSf4Flow()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 17

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 17
rs 9.7
c 0
b 0
f 0
cc 1
nc 1
nop 0
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
Documentation introduced by
$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()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
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
Documentation introduced by
$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