Passed
Push — master ( 57230d...aff590 )
by Jean-Bernard
01:48
created

tests/VariadicControllerTest.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
/*
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\VariadicController;
17
18
/**
19
 * @covers \SymfonyUtil\Controller\VariadicController
20
 * @requires PHP 5.6.0
21
 */
22
final class VariadicControllerTest extends TestCase
23
{
24 View Code Duplication
    public function testCanBeCreated()
25
    {
26
        $this->assertInstanceOf(
27
            VariadicController::class,
28
            new VariadicController(new TwigEngine(
29
                new Twig_Environment(new Twig_Loader_Array(['index.html.twig' => 'Hello World!'])),
30
                new TemplateNameParser()
31
            ))
32
        );
33
    }
34
35 View Code Duplication
    public function testEmptyReturnsResponse()
0 ignored issues
show
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...
36
    {
37
        $this->assertInstanceOf(
38
            Response::class,
39
            (new VariadicController(new TwigEngine(
40
                new Twig_Environment(new Twig_Loader_Array(['index.html.twig' => 'Hello World!'])),
41
                new TemplateNameParser()
42
            )))->__invoke()
43
        );
44
    }
45
46 View Code Duplication
    public function testArrayReturnsResponse()
0 ignored issues
show
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...
47
    {
48
        $this->assertInstanceOf(
49
            Response::class,
50
            (new VariadicController(new TwigEngine(
51
                new Twig_Environment(new Twig_Loader_Array([
52
                    'index.html.twig' => '<ul>{% for item in 0 %}<li>{{ item }}</li>{% endfor %}</ul>',
53
                ])),
54
                new TemplateNameParser()
55
            )))->__invoke([
56
                'One',
57
                'Two',
58
                'Three',
59
            ])
60
        );
61
    }
62
}
63
64
// http://api.symfony.com/3.3/Symfony/Bridge/Twig/TwigEngine.html
65
// http://api.symfony.com/3.3/Symfony/Bundle/TwigBundle/TwigEngine.html
66