1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace Sylius\Behat\Context\Ui\Admin; |
6
|
|
|
|
7
|
|
|
use Behat\Behat\Context\Context; |
8
|
|
|
use Sylius\Behat\Element\Admin\Channel\ShopBillingDataElementInterface; |
9
|
|
|
use Sylius\Component\Addressing\Model\CountryInterface; |
10
|
|
|
use Webmozart\Assert\Assert; |
11
|
|
|
|
12
|
|
|
final class ManagingChannelsBillingDataContext implements Context |
13
|
|
|
{ |
14
|
|
|
/** @var ShopBillingDataElementInterface */ |
15
|
|
|
private $shopBillingDataElement; |
16
|
|
|
|
17
|
|
|
public function __construct(ShopBillingDataElementInterface $shopBillingDataElement) |
18
|
|
|
{ |
19
|
|
|
$this->shopBillingDataElement = $shopBillingDataElement; |
20
|
|
|
} |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* @When I specify company as :company |
24
|
|
|
*/ |
25
|
|
|
public function specifyCompanyAs(string $company): void |
26
|
|
|
{ |
27
|
|
|
$this->shopBillingDataElement->specifyCompany($company); |
28
|
|
|
} |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* @When I specify tax ID as :taxId |
32
|
|
|
*/ |
33
|
|
|
public function specifyTaxIdAs(string $taxId): void |
34
|
|
|
{ |
35
|
|
|
$this->shopBillingDataElement->specifyTaxId($taxId); |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* @When I specify shop billing address as :street, :postcode :city, :country |
40
|
|
|
*/ |
41
|
|
|
public function specifyShopBillingAddressAs( |
42
|
|
|
string $street, |
43
|
|
|
string $postcode, |
44
|
|
|
string $city, |
45
|
|
|
CountryInterface $country |
46
|
|
|
): void { |
47
|
|
|
$this->shopBillingDataElement->specifyBillingAddress($street, $postcode, $city, $country->getCode()); |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* @Then this channel company should be :company |
52
|
|
|
*/ |
53
|
|
|
public function thisChannelCompanyShouldBe(string $company): void |
54
|
|
|
{ |
55
|
|
|
Assert::true($this->shopBillingDataElement->hasCompany($company)); |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* @Then this channel tax ID should be :taxId |
60
|
|
|
*/ |
61
|
|
|
public function thisChanneTaxIdShouldBe(string $taxId): void |
62
|
|
|
{ |
63
|
|
|
Assert::true($this->shopBillingDataElement->hasTaxId($taxId)); |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* @Then this channel shop billing address should be :street, :postcode :city, :country |
68
|
|
|
*/ |
69
|
|
|
public function thisChannelShopBillingAddressShouldBe( |
70
|
|
|
string $street, |
71
|
|
|
string $postcode, |
72
|
|
|
string $city, |
73
|
|
|
CountryInterface $country |
74
|
|
|
): void { |
75
|
|
|
Assert::true($this->shopBillingDataElement->hasBillingAddress($street, $postcode, $city, $country->getCode())); |
76
|
|
|
} |
77
|
|
|
} |
78
|
|
|
|