1 | <?php |
||
27 | final class CustomerContext implements Context |
||
28 | { |
||
29 | /** |
||
30 | * @var SharedStorageInterface |
||
31 | */ |
||
32 | private $sharedStorage; |
||
33 | |||
34 | /** |
||
35 | * @var CustomerRepositoryInterface |
||
36 | */ |
||
37 | private $customerRepository; |
||
38 | |||
39 | /** |
||
40 | * @var ObjectManager |
||
41 | */ |
||
42 | private $customerManager; |
||
43 | |||
44 | /** |
||
45 | * @var FactoryInterface |
||
46 | */ |
||
47 | private $customerFactory; |
||
48 | |||
49 | /** |
||
50 | * @var FactoryInterface |
||
51 | */ |
||
52 | private $userFactory; |
||
53 | |||
54 | /** |
||
55 | * @param SharedStorageInterface $sharedStorage |
||
56 | * @param CustomerRepositoryInterface $customerRepository |
||
57 | * @param ObjectManager $customerManager |
||
58 | * @param FactoryInterface $customerFactory |
||
59 | * @param FactoryInterface $userFactory |
||
60 | */ |
||
61 | public function __construct( |
||
74 | |||
75 | /** |
||
76 | * @Given the store has customer :name with email :email |
||
77 | */ |
||
78 | public function theStoreHasCustomerWithNameAndEmail($name, $email) |
||
83 | |||
84 | /** |
||
85 | * @Given the store has customer :email |
||
86 | */ |
||
87 | public function theStoreHasCustomer($email) |
||
91 | |||
92 | /** |
||
93 | * @Given the store has customer :email with first name :firstName |
||
94 | */ |
||
95 | public function theStoreHasCustomerWithFirstName($email, $firstName) |
||
99 | |||
100 | /** |
||
101 | * @Given the store has customer :email with last name :lastName |
||
102 | */ |
||
103 | public function theStoreHasCustomerWithLastName($email, $lastName) |
||
107 | |||
108 | /** |
||
109 | * @Given the store has customer :email with name :fullName since :since |
||
110 | */ |
||
111 | public function theStoreHasCustomerWithNameAndRegistrationDate($email, $fullName, $since) |
||
116 | |||
117 | /** |
||
118 | * @Given there is disabled customer account :email with password :password |
||
119 | */ |
||
120 | public function thereIsDisabledCustomerAccountWithPassword($email, $password) |
||
124 | |||
125 | /** |
||
126 | * @Given there is enabled customer account :email with password :password |
||
127 | * @Given there is a customer account :email identified by :password |
||
128 | */ |
||
129 | public function theStoreHasEnabledCustomerAccountWithPassword($email, $password) |
||
133 | |||
134 | /** |
||
135 | * @Given there is a customer :name identified by an email :email and a password :password |
||
136 | */ |
||
137 | public function theStoreHasCustomerAccountWithEmailAndPassword($name, $email, $password) |
||
145 | |||
146 | /** |
||
147 | * @Given there is an administrator :name identified by an email :email and a password :password |
||
148 | */ |
||
149 | public function thereIsAdministratorIdentifiedByEmailAndPassword($name, $email, $password) |
||
157 | |||
158 | /** |
||
159 | * @Given /^(his) default (address is "(?:[^"]+)", "(?:[^"]+)", "(?:[^"]+)", "(?:[^"]+)" for "(?:[^"]+)")$/ |
||
160 | * @Given /^(his) default (address is "([^"]+)", "([^"]+)", "([^"]+)", "([^"]+)", "([^"]+)", "([^"]+)")$/ |
||
161 | */ |
||
162 | public function heHasDefaultAddress(CustomerInterface $customer, AddressInterface $address) |
||
168 | |||
169 | /** |
||
170 | * @Given /^(the customer) subscribed to the newsletter$/ |
||
171 | */ |
||
172 | public function theCustomerSubscribedToTheNewsletter(CustomerInterface $customer) |
||
178 | |||
179 | /** |
||
180 | * @Given /^(I) have an (address "[^"]+", "[^"]+", "[^"]+", "[^"]+", "[^"]+"(?:|, "[^"]+")) in my address book$/ |
||
181 | */ |
||
182 | public function iHaveAnAddressInAddressBook(ShopUserInterface $user, AddressInterface $address) |
||
189 | |||
190 | /** |
||
191 | * @Given /^(this customer) has an (address "[^"]+", "[^"]+", "[^"]+", "[^"]+", "[^"]+"(?:|, "[^"]+")) in their address book$/ |
||
192 | */ |
||
193 | public function thisCustomerHasAnAddressInAddressBook(CustomerInterface $customer, AddressInterface $address) |
||
199 | |||
200 | /** |
||
201 | * @Given /^(this customer) verified their email$/ |
||
202 | */ |
||
203 | public function theCustomerVerifiedTheirEmail(CustomerInterface $customer) |
||
209 | |||
210 | /** |
||
211 | * @Given /^(the customer) belongs to (group "([^"]+)")$/ |
||
212 | */ |
||
213 | public function theCustomerBelongsToGroup(CustomerInterface $customer, CustomerGroupInterface $customerGroup) |
||
219 | |||
220 | /** |
||
221 | * @param string $email |
||
222 | * @param string|null $firstName |
||
223 | * @param string|null $lastName |
||
224 | * @param \DateTime|null $createdAt |
||
225 | */ |
||
226 | private function createCustomer($email, $firstName = null, $lastName = null, \DateTime $createdAt = null) |
||
241 | |||
242 | /** |
||
243 | * @param string $email |
||
244 | * @param string $password |
||
245 | * @param bool $enabled |
||
246 | * @param string|null $firstName |
||
247 | * @param string|null $lastName |
||
248 | * @param string|null $role |
||
249 | */ |
||
250 | private function createCustomerWithUserAccount( |
||
276 | } |
||
277 |