Completed
Push — master ( f5ae4e...78a789 )
by Jean-Bernard
02:28 queued 27s
created

testReturnsResponse()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 6
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the Symfony-Util package.
5
 *
6
 * (c) Jean-Bernard Addor
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
use PHPUnit\Framework\TestCase;
13
use Symfony\Bridge\Twig\TwigEngine;
14
use Symfony\Component\HttpFoundation\Response;
15
use Symfony\Component\Templating\TemplateNameParser;
16
use SymfonyUtil\Controller\EngineAsArgumentController;
17
18
/**
19
 * @covers \SymfonyUtil\Controller\EngineAsArgumentController
20
 */
21
final class EngineAsArgumentControllerTest extends TestCase
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
22
{
23
    public function testCanBeCreated()
24
    {
25
        $this->assertInstanceOf(
26
            // EngineAsArgumentController::class, // 5.4 < php
27
            'SymfonyUtil\Controller\EngineAsArgumentController',
28
            new EngineAsArgumentController()
29
        );
30
    }
31
32
    public function testReturnsResponse()
33
    {
34
        $this->assertInstanceOf(
35
            // Response::class, // 5.4 < php
36
            'Symfony\Component\HttpFoundation\Response',
37
            (new EngineAsArgumentController())->__invoke(new TwigEngine(
38
                new Twig_Environment(new Twig_Loader_Array(['index.html.twig' => 'Hello World!'])),
0 ignored issues
show
Compatibility introduced by
new \Twig_Environment(ne...g' => 'Hello World!'))) of type object<Twig_Environment> is not a sub-type of object<Twig\Environment>. It seems like you assume a child class of the class Twig_Environment to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
39
                new TemplateNameParser()
40
            ))
41
        );
42
    }
43
}
44
45
// http://api.symfony.com/3.3/Symfony/Bridge/Twig/TwigEngine.html
46
// http://api.symfony.com/3.3/Symfony/Bundle/TwigBundle/TwigEngine.html
47