KitchensinkControllerTest::testIndexAction()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 26

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 26
rs 9.504
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace BestIt\KitchensinkBundle\Tests\Controller;
4
5
use BestIt\KitchensinkBundle\Controller\KitchensinkController;
6
use BestIt\KitchensinkBundle\Tests\DataProviderFake;
7
use PHPUnit\Framework\TestCase;
8
use Twig\Environment;
9
10
/**
11
 * Class KitchensinkControllerTest
12
 *
13
 * @author blange <[email protected]>
14
 * @package BestIt\KitchensinkBundle
15
 */
16
class KitchensinkControllerTest extends TestCase
17
{
18
    /**
19
     * Test index action
20
     *
21
     * @return void
22
     */
23
    public function testIndexAction()
24
    {
25
        $controller = new KitchensinkController(
26
            $provider = new DataProviderFake(),
27
            $templateEngine = $this->createMock(Environment::class),
28
            $templateName = uniqid()
29
        );
30
31
        $templateEngine
32
            ->expects(static::once())
33
            ->method('render')
34
            ->with(
35
                $templateName,
36
                [
37
                    'foo' => 'BestIt\KitchensinkBundle\Tests\DataProviderFake::bar',
38
                    'foobar' => 'BestIt\KitchensinkBundle\Tests\DataProviderFake::getFoobar',
39
                    'foobarBaz' => 'BestIt\KitchensinkBundle\Tests\DataProviderFake::getFoobarBaz'
40
                ]
41
            )
42
            ->willReturn($result = uniqid());
43
44
        $response = $controller->indexAction();
45
46
        static::assertSame($result, $response->getContent());
47
        static::assertSame(200, $response->getStatusCode());
48
    }
49
}
50