Completed
Push — 1.0 ( 5f7e14...62fb10 )
by Kamil
35:39
created

DashboardStatisticsSpec   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 6
c 0
b 0
f 0
lcom 0
cbo 1
dl 0
loc 34
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A let() 0 4 1
A it_has_total_sales_stat() 0 4 1
A it_has_new_orders_stat() 0 4 1
A ith_has_new_customers_stat() 0 4 1
A it_calculates_an_average_order_value() 0 4 1
A it_returns_0_as_average_order_value_when_there_are_no_orders() 0 6 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
declare(strict_types=1);
13
14
namespace spec\Sylius\Component\Core\Dashboard;
15
16
use PhpSpec\ObjectBehavior;
17
18
final class DashboardStatisticsSpec extends ObjectBehavior
19
{
20
    function let(): void
21
    {
22
        $this->beConstructedWith(2564, 24, 10);
23
    }
24
25
    function it_has_total_sales_stat(): void
26
    {
27
        $this->getTotalSales()->shouldReturn(2564);
28
    }
29
30
    function it_has_new_orders_stat(): void
31
    {
32
        $this->getNumberOfNewOrders()->shouldReturn(24);
33
    }
34
35
    function ith_has_new_customers_stat(): void
36
    {
37
        $this->getNumberOfNewCustomers()->shouldReturn(10);
38
    }
39
40
    function it_calculates_an_average_order_value(): void
41
    {
42
        $this->getAverageOrderValue()->shouldReturn(107);
43
    }
44
45
    function it_returns_0_as_average_order_value_when_there_are_no_orders(): void
46
    {
47
        $this->beConstructedWith(0, 0, 2);
48
49
        $this->getAverageOrderValue()->shouldReturn(0);
50
    }
51
}
52