|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Sylius\Behat\Element\Admin\Channel; |
|
6
|
|
|
|
|
7
|
|
|
use FriendsOfBehat\PageObjectExtension\Element\Element; |
|
8
|
|
|
|
|
9
|
|
|
final class ShopBillingDataElement extends Element implements ShopBillingDataElementInterface |
|
10
|
|
|
{ |
|
11
|
|
|
public function specifyCompany(string $company): void |
|
12
|
|
|
{ |
|
13
|
|
|
$this->getElement('company')->setValue($company); |
|
14
|
|
|
} |
|
15
|
|
|
|
|
16
|
|
|
public function specifyTaxId(string $taxId): void |
|
17
|
|
|
{ |
|
18
|
|
|
$this->getElement('tax_id')->setValue($taxId); |
|
19
|
|
|
} |
|
20
|
|
|
|
|
21
|
|
|
public function specifyBillingAddress(string $street, string $postcode, string $city, string $countryCode): void |
|
22
|
|
|
{ |
|
23
|
|
|
$this->getElement('street')->setValue($street); |
|
24
|
|
|
$this->getElement('postcode')->setValue($postcode); |
|
25
|
|
|
$this->getElement('city')->setValue($city); |
|
26
|
|
|
$this->getElement('country_code')->setValue($countryCode); |
|
27
|
|
|
} |
|
28
|
|
|
|
|
29
|
|
|
public function hasCompany(string $company): bool |
|
30
|
|
|
{ |
|
31
|
|
|
return $company === $this->getElement('company')->getValue(); |
|
32
|
|
|
} |
|
33
|
|
|
|
|
34
|
|
|
public function hasTaxId(string $taxId): bool |
|
35
|
|
|
{ |
|
36
|
|
|
return $taxId === $this->getElement('tax_id')->getValue(); |
|
37
|
|
|
} |
|
38
|
|
|
|
|
39
|
|
|
public function hasBillingAddress(string $street, string $postcode, string $city, string $countryCode): bool |
|
40
|
|
|
{ |
|
41
|
|
|
return |
|
42
|
|
|
$street === $this->getElement('street')->getValue() && |
|
43
|
|
|
$postcode === $this->getElement('postcode')->getValue() && |
|
44
|
|
|
$city === $this->getElement('city')->getValue() && |
|
45
|
|
|
$countryCode === $this->getElement('country_code')->getValue() |
|
46
|
|
|
; |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
protected function getDefinedElements(): array |
|
50
|
|
|
{ |
|
51
|
|
|
return array_merge(parent::getDefinedElements(), [ |
|
52
|
|
|
'city' => '#sylius_channel_shopBillingData_city', |
|
53
|
|
|
'company' => '#sylius_channel_shopBillingData_company', |
|
54
|
|
|
'country_code' => '#sylius_channel_shopBillingData_countryCode', |
|
55
|
|
|
'postcode' => '#sylius_channel_shopBillingData_postcode', |
|
56
|
|
|
'street' => '#sylius_channel_shopBillingData_street', |
|
57
|
|
|
'tax_id' => '#sylius_channel_shopBillingData_taxId', |
|
58
|
|
|
]); |
|
59
|
|
|
} |
|
60
|
|
|
} |
|
61
|
|
|
|