Completed
Push — locale-in-url ( 6d9eda...81052c )
by Kamil
57:16 queued 38:25
created

CheckoutOrderDetailsContext::__construct()   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
namespace Sylius\Behat\Context\Ui\Shop\Checkout;
4
5
use Behat\Behat\Context\Context;
6
use Sylius\Behat\Page\Shop\Order\ShowPageInterface;
7
use Sylius\Component\Core\Model\OrderInterface;
8
use Webmozart\Assert\Assert;
9
10
/**
11
 * @author Kamil Kokot <[email protected]>
12
 */
13
final class CheckoutOrderDetailsContext implements Context
14
{
15
    /**
16
     * @var ShowPageInterface
17
     */
18
    private $orderDetails;
19
20
    /**
21
     * @param ShowPageInterface $orderDetails
22
     */
23
    public function __construct(ShowPageInterface $orderDetails)
24
    {
25
        $this->orderDetails = $orderDetails;
26
    }
27
28
    /**
29
     * @When /^I want to browse order details for (this order)$/
30
     */
31
    public function iWantToBrowseOrderDetailsForThisOrder(OrderInterface $order)
32
    {
33
        $this->orderDetails->open(['tokenValue' => $order->getTokenValue()]);
34
    }
35
36
    /**
37
     * @When I change payment method to :paymentMethodName
38
     */
39
    public function iChangePaymentMethodTo($paymentMethodName)
40
    {
41
        $this->orderDetails->choosePaymentMethod($paymentMethodName);
42
    }
43
44
    /**
45
     * @Then I should be able to pay (again)
46
     */
47
    public function iShouldBeAbleToPay()
48
    {
49
        Assert::true($this->orderDetails->hasPayAction());
50
    }
51
52
    /**
53
     * @Then I should not be able to pay (again)
54
     */
55
    public function iShouldNotBeAbleToPay()
56
    {
57
        Assert::false($this->orderDetails->hasPayAction());
58
    }
59
}
60