1 | <?php |
||
26 | class UserContext implements Context |
||
27 | { |
||
28 | /** |
||
29 | * @var RepositoryInterface |
||
30 | */ |
||
31 | private $userRepository; |
||
32 | |||
33 | /** |
||
34 | * @var SharedStorageInterface |
||
35 | */ |
||
36 | private $sharedStorage; |
||
37 | |||
38 | /** |
||
39 | * @var FactoryInterface |
||
40 | */ |
||
41 | private $userFactory; |
||
42 | |||
43 | /** |
||
44 | * @var FactoryInterface |
||
45 | */ |
||
46 | private $customerFactory; |
||
47 | |||
48 | /** |
||
49 | * @var FactoryInterface |
||
50 | */ |
||
51 | private $addressFactory; |
||
52 | |||
53 | /** |
||
54 | * @param RepositoryInterface $userRepository |
||
55 | * @param SharedStorageInterface $sharedStorage |
||
56 | * @param FactoryInterface $userFactory |
||
57 | * @param FactoryInterface $customerFactory |
||
58 | * @param FactoryInterface $addressFactory |
||
59 | */ |
||
60 | public function __construct( |
||
73 | |||
74 | /** |
||
75 | * @Given there is user :email identified by :password |
||
76 | */ |
||
77 | public function thereIsUserIdentifiedBy($email, $password) |
||
85 | |||
86 | /** |
||
87 | * @Given there is user :email identified by :password, with :country as shipping country |
||
88 | */ |
||
89 | public function thereIsUserWithShippingCountry($email, $password, $country) |
||
99 | |||
100 | /** |
||
101 | * @param string $firstName |
||
102 | * @param string $lastName |
||
103 | * |
||
104 | * @return CustomerInterface |
||
105 | */ |
||
106 | private function createCustomer($firstName = 'John', $lastName = 'Doe') |
||
114 | |||
115 | /** |
||
116 | * @param CustomerInterface $customer |
||
117 | * @param string $email |
||
118 | * @param string $password |
||
119 | * |
||
120 | * @return UserInterface |
||
121 | */ |
||
122 | private function createUser( |
||
136 | |||
137 | /** |
||
138 | * @param string $firstName |
||
139 | * @param string $lastName |
||
140 | * @param string $country |
||
141 | * @param string $street |
||
142 | * @param string $city |
||
143 | * @param string $postcode |
||
144 | * |
||
145 | * @return AddressInterface |
||
146 | */ |
||
147 | private function createAddress( |
||
165 | |||
166 | /** |
||
167 | * @param string $name |
||
168 | * |
||
169 | * @return string |
||
170 | * |
||
171 | * @throws \InvalidArgumentException If name is not found in country code registry. |
||
172 | */ |
||
173 | private function getCountryCodeByEnglishCountryName($name) |
||
186 | } |
||
187 |