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\ThankYouPageInterface; |
7
|
|
|
use Sylius\Component\Core\Model\PaymentMethodInterface; |
8
|
|
|
use Webmozart\Assert\Assert; |
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* @author Kamil Kokot <[email protected]> |
12
|
|
|
*/ |
13
|
|
|
final class CheckoutThankYouContext implements Context |
14
|
|
|
{ |
15
|
|
|
/** |
16
|
|
|
* @var ThankYouPageInterface |
17
|
|
|
*/ |
18
|
|
|
private $thankYouPage; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* @param ThankYouPageInterface $thankYouPage |
22
|
|
|
*/ |
23
|
|
|
public function __construct(ThankYouPageInterface $thankYouPage) |
24
|
|
|
{ |
25
|
|
|
$this->thankYouPage = $thankYouPage; |
26
|
|
|
} |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @Then I should see the thank you page |
30
|
|
|
*/ |
31
|
|
|
public function iShouldSeeTheThankYouPage() |
32
|
|
|
{ |
33
|
|
|
Assert::true($this->thankYouPage->hasThankYouMessage()); |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* @Then I should see the thank you page in :localeCode |
38
|
|
|
*/ |
39
|
|
|
public function iShouldSeeTheThankYouPageInLocale($localeCode) |
40
|
|
|
{ |
41
|
|
|
Assert::false($this->thankYouPage->isOpen(['_locale' => $localeCode])); |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* @Then I should not see the thank you page |
46
|
|
|
*/ |
47
|
|
|
public function iShouldNotSeeTheThankYouPage() |
48
|
|
|
{ |
49
|
|
|
Assert::false($this->thankYouPage->isOpen()); |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* @Then I should be informed with :paymentMethod payment method instructions |
54
|
|
|
*/ |
55
|
|
|
public function iShouldBeInformedWithPaymentMethodInstructions(PaymentMethodInterface $paymentMethod) |
56
|
|
|
{ |
57
|
|
|
Assert::same($this->thankYouPage->getInstructions(), $paymentMethod->getInstructions()); |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @Then I should not see any instructions about payment method |
62
|
|
|
*/ |
63
|
|
|
public function iShouldNotSeeAnyInstructionsAboutPaymentMethod() |
64
|
|
|
{ |
65
|
|
|
Assert::false($this->thankYouPage->hasInstructions()); |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* @Then I should not be able to change payment method |
70
|
|
|
*/ |
71
|
|
|
public function iShouldNotBeAbleToChangeMyPaymentMethod() |
72
|
|
|
{ |
73
|
|
|
Assert::false($this->thankYouPage->hasChangePaymentMethodButton()); |
74
|
|
|
} |
75
|
|
|
} |
76
|
|
|
|