Completed
Push — 1.3-php-7.3 ( e95dc4 )
by Kamil
45:30 queued 31:53
created

iShouldSeeAsNumberOfItems()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
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
declare(strict_types=1);
13
14
namespace Sylius\Behat\Context\Ui\Shop\Checkout;
15
16
use Behat\Behat\Context\Context;
17
use Sylius\Behat\Page\Shop\Order\ShowPageInterface;
18
use Sylius\Component\Core\Model\OrderInterface;
19
use Webmozart\Assert\Assert;
20
21
final class CheckoutOrderDetailsContext implements Context
22
{
23
    /**
24
     * @var ShowPageInterface
25
     */
26
    private $orderDetails;
27
28
    /**
29
     * @param ShowPageInterface $orderDetails
30
     */
31
    public function __construct(ShowPageInterface $orderDetails)
32
    {
33
        $this->orderDetails = $orderDetails;
34
    }
35
36
    /**
37
     * @When /^I want to browse order details for (this order)$/
38
     */
39
    public function iWantToBrowseOrderDetailsForThisOrder(OrderInterface $order)
40
    {
41
        $this->orderDetails->open(['tokenValue' => $order->getTokenValue()]);
42
    }
43
44
    /**
45
     * @When I try to pay with :paymentMethodName payment method
46
     */
47
    public function iChangePaymentMethodTo($paymentMethodName)
48
    {
49
        $this->orderDetails->choosePaymentMethod($paymentMethodName);
50
        $this->orderDetails->pay();
51
    }
52
53
    /**
54
     * @Then I should be able to pay (again)
55
     */
56
    public function iShouldBeAbleToPay()
57
    {
58
        Assert::true($this->orderDetails->hasPayAction());
59
    }
60
61
    /**
62
     * @Then I should not be able to pay (again)
63
     */
64
    public function iShouldNotBeAbleToPay()
65
    {
66
        Assert::false($this->orderDetails->hasPayAction());
67
    }
68
69
    /**
70
     * @Then I should see :quantity as number of items
71
     */
72
    public function iShouldSeeAsNumberOfItems(int $quantity): void
73
    {
74
        Assert::same($this->orderDetails->getNumberOfItems(), $quantity);
75
    }
76
}
77