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

DashboardContext   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 71
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 4
Bugs 1 Features 2
Metric Value
wmc 8
c 4
b 1
f 2
lcom 1
cbo 2
dl 0
loc 71
rs 10

8 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A iOpenAdministrationDashboard() 0 4 1
A iShouldSeeNewOrders() 0 4 1
A iShouldSeeNewCustomers() 0 4 1
A thereShouldBeTotalSalesOf() 0 4 1
A myAverageOrderValueShouldBe() 0 4 1
A iShouldSeeCustomersInTheList2() 0 4 1
A iShouldSeeNewOrdersInTheList() 0 4 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 Sylius\Behat\Context\Ui\Admin;
13
14
use Behat\Behat\Context\Context;
15
use Sylius\Behat\Page\Admin\DashboardPageInterface;
16
use Webmozart\Assert\Assert;
17
18
/**
19
 * @author Paweł Jędrzejewski <[email protected]>
20
 */
21
final class DashboardContext implements Context
22
{
23
    /**
24
     * @var DashboardPageInterface
25
     */
26
    private $dashboardPage;
27
28
    /**
29
     * @param DashboardPageInterface $dashboardPage
30
     */
31
    public function __construct(DashboardPageInterface $dashboardPage)
32
    {
33
        $this->dashboardPage = $dashboardPage;
34
    }
35
36
    /**
37
     * @When I open administration dashboard
38
     */
39
    public function iOpenAdministrationDashboard()
40
    {
41
        $this->dashboardPage->open();
42
    }
43
44
    /**
45
     * @Then I should see :number new orders
46
     */
47
    public function iShouldSeeNewOrders($number)
48
    {
49
        Assert::same($this->dashboardPage->getNumberOfNewOrders(), $number);
50
    }
51
52
    /**
53
     * @Then I should see :number new customers
54
     */
55
    public function iShouldSeeNewCustomers($number)
56
    {
57
        Assert::same($this->dashboardPage->getNumberOfNewCustomers(), $number);
58
    }
59
60
    /**
61
     * @Then there should be total sales of :total
62
     */
63
    public function thereShouldBeTotalSalesOf($total)
64
    {
65
        Assert::same($this->dashboardPage->getTotalSales(), $total);
66
    }
67
68
    /**
69
     * @Then the average order value should be :value
70
     */
71
    public function myAverageOrderValueShouldBe($value)
72
    {
73
        Assert::same($this->dashboardPage->getAverageOrderValue(), $value);
74
    }
75
76
    /**
77
     * @Then I should see :number customers in the list
78
     */
79
    public function iShouldSeeCustomersInTheList2($number)
80
    {
81
        Assert::same($this->dashboardPage->getNumberOfNewCustomersInTheList(), $number);
82
    }
83
84
    /**
85
     * @Then I should see :number new orders in the list
86
     */
87
    public function iShouldSeeNewOrdersInTheList($number)
88
    {
89
        Assert::same($this->dashboardPage->getNumberOfNewOrdersInTheList(), $number);
90
    }
91
}
92