Completed
Push — master ( d54afb...01173a )
by Kamil
26:45
created

DashboardControllerSpec::it_renders_dashboard()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
nc 1
cc 1
eloc 3
nop 3
1
<?php
2
3
/*
4
 * This file is part of the Sylius package.
5
 *
6
 * (c) Paweł Jędrzejewski
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
namespace spec\Sylius\Bundle\AdminBundle\Controller;
13
14
use PhpSpec\ObjectBehavior;
15
use Sylius\Bundle\AdminBundle\Controller\DashboardController;
16
use Sylius\Component\Core\Dashboard\DashboardStatistics;
17
use Sylius\Component\Core\Dashboard\DashboardStatisticsProviderInterface;
18
use Symfony\Bundle\FrameworkBundle\Templating\EngineInterface;
19
use Symfony\Component\HttpFoundation\Request;
20
use Symfony\Component\HttpFoundation\Response;
21
22
/**
23
 * @mixin DashboardController
24
 *
25
 * @author Paweł Jędrzejewski <[email protected]>
26
 */
27
class DashboardControllerSpec extends ObjectBehavior
28
{
29
    function let(DashboardStatisticsProviderInterface $dashboardStatsProvider, EngineInterface $templatingEngine)
30
    {
31
        $this->beConstructedWith($dashboardStatsProvider, $templatingEngine);
32
    }
33
34
    function it_is_initializable()
35
    {
36
        $this->shouldHaveType('Sylius\Bundle\AdminBundle\Controller\DashboardController');
37
    }
38
39
    function it_renders_dashboard_with_statistics(
40
        Request $request,
41
        DashboardStatisticsProviderInterface $dashboardStatsProvider,
42
        EngineInterface $templatingEngine,
43
        Response $response
44
    ) {
45
        $dashboardStats = new DashboardStatistics(1245, 5, 6);
46
        $dashboardStatsProvider->getStatistics()->willReturn($dashboardStats);
47
        $templatingEngine
48
            ->renderResponse('SyliusAdminBundle:Dashboard:index.html.twig', ['statistics' => $dashboardStats])
49
            ->willReturn($response)
50
        ;
51
52
        $this->indexAction($request)->shouldReturn($response);
53
    }
54
}
55