Completed
Push — symfony3-fqcn-sylius-3 ( 1d8d47...2ae323 )
by Kamil
38:58 queued 18:19
created

iOpenAdministrationDashboardForChannel()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 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
     * @When I open administration dashboard for :code channel
46
     */
47
    public function iOpenAdministrationDashboardForChannel($code)
48
    {
49
        $this->dashboardPage->open(['channelCode' => $code]);
50
    }
51
52
    /**
53
     * @When I choose :channelName channel
54
     */
55
    public function iChooseChannel($channelName)
56
    {
57
        $this->dashboardPage->chooseChannel($channelName);
58
    }
59
60
    /**
61
     * @Then I should be on the administration dashboard
62
     */
63
    public function iShouldBeOnAdministrationDashboard()
64
    {
65
        Assert::true($this->dashboardPage->isOpen());
66
    }
67
68
    /**
69
     * @Then I should see :number new orders
70
     */
71
    public function iShouldSeeNewOrders($number)
72
    {
73
        Assert::same($this->dashboardPage->getNumberOfNewOrders(), (int) $number);
74
    }
75
76
    /**
77
     * @Then I should see :number new customers
78
     */
79
    public function iShouldSeeNewCustomers($number)
80
    {
81
        Assert::same($this->dashboardPage->getNumberOfNewCustomers(), (int) $number);
82
    }
83
84
    /**
85
     * @Then there should be total sales of :total
86
     */
87
    public function thereShouldBeTotalSalesOf($total)
88
    {
89
        Assert::same($this->dashboardPage->getTotalSales(), $total);
90
    }
91
92
    /**
93
     * @Then the average order value should be :value
94
     */
95
    public function myAverageOrderValueShouldBe($value)
96
    {
97
        Assert::same($this->dashboardPage->getAverageOrderValue(), $value);
98
    }
99
100
    /**
101
     * @Then I should see :number new customers in the list
102
     */
103
    public function iShouldSeeNewCustomersInTheList($number)
104
    {
105
        Assert::same($this->dashboardPage->getNumberOfNewCustomersInTheList(), (int) $number);
106
    }
107
108
    /**
109
     * @Then I should see :number new orders in the list
110
     */
111
    public function iShouldSeeNewOrdersInTheList($number)
112
    {
113
        Assert::same($this->dashboardPage->getNumberOfNewOrdersInTheList(), (int) $number);
114
    }
115
}
116