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

DashboardControllerSpec   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 3
c 1
b 0
f 1
lcom 0
cbo 4
dl 0
loc 28
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A let() 0 4 1
A it_is_initializable() 0 4 1
A it_renders_dashboard_with_statistics() 0 15 1
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