1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the Sylius package. |
5
|
|
|
* |
6
|
|
|
* (c) Paweł Jędrzejewski |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace Sylius\Behat\Context\Ui\Admin; |
13
|
|
|
|
14
|
|
|
use Behat\Behat\Context\Context; |
15
|
|
|
use Sylius\Behat\NotificationType; |
16
|
|
|
use Sylius\Behat\Page\Admin\Order\HistoryPageInterface; |
17
|
|
|
use Sylius\Behat\Page\Admin\Order\IndexPageInterface; |
18
|
|
|
use Sylius\Behat\Page\Admin\Order\ShowPageInterface; |
19
|
|
|
use Sylius\Behat\Page\Admin\Order\UpdatePageInterface; |
20
|
|
|
use Sylius\Behat\Service\NotificationCheckerInterface; |
21
|
|
|
use Sylius\Behat\Service\SharedSecurityServiceInterface; |
22
|
|
|
use Sylius\Behat\Service\SharedStorageInterface; |
23
|
|
|
use Sylius\Component\Addressing\Model\AddressInterface; |
24
|
|
|
use Sylius\Component\Core\Model\AdminUserInterface; |
25
|
|
|
use Sylius\Component\Core\Model\CustomerInterface; |
26
|
|
|
use Sylius\Component\Core\Model\OrderInterface; |
27
|
|
|
use Webmozart\Assert\Assert; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* @author Paweł Jędrzejewski <[email protected]> |
31
|
|
|
* @author Grzegorz Sadowski <[email protected]> |
32
|
|
|
*/ |
33
|
|
|
final class ManagingOrdersContext implements Context |
34
|
|
|
{ |
35
|
|
|
/** |
36
|
|
|
* @var SharedStorageInterface |
37
|
|
|
*/ |
38
|
|
|
private $sharedStorage; |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* @var IndexPageInterface |
42
|
|
|
*/ |
43
|
|
|
private $indexPage; |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* @var ShowPageInterface |
47
|
|
|
*/ |
48
|
|
|
private $showPage; |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* @var UpdatePageInterface |
52
|
|
|
*/ |
53
|
|
|
private $updatePage; |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* @var HistoryPageInterface |
57
|
|
|
*/ |
58
|
|
|
private $historyPage; |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @var NotificationCheckerInterface |
62
|
|
|
*/ |
63
|
|
|
private $notificationChecker; |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* @var SharedSecurityServiceInterface |
67
|
|
|
*/ |
68
|
|
|
private $sharedSecurityService; |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* @param SharedStorageInterface $sharedStorage |
72
|
|
|
* @param IndexPageInterface $indexPage |
73
|
|
|
* @param ShowPageInterface $showPage |
74
|
|
|
* @param UpdatePageInterface $updatePage |
75
|
|
|
* @param HistoryPageInterface $historyPage |
76
|
|
|
* @param NotificationCheckerInterface $notificationChecker |
77
|
|
|
* @param SharedSecurityServiceInterface $sharedSecurityService |
78
|
|
|
*/ |
79
|
|
|
public function __construct( |
80
|
|
|
SharedStorageInterface $sharedStorage, |
81
|
|
|
IndexPageInterface $indexPage, |
82
|
|
|
ShowPageInterface $showPage, |
83
|
|
|
UpdatePageInterface $updatePage, |
84
|
|
|
HistoryPageInterface $historyPage, |
85
|
|
|
NotificationCheckerInterface $notificationChecker, |
86
|
|
|
SharedSecurityServiceInterface $sharedSecurityService |
87
|
|
|
) { |
88
|
|
|
$this->sharedStorage = $sharedStorage; |
89
|
|
|
$this->indexPage = $indexPage; |
90
|
|
|
$this->showPage = $showPage; |
91
|
|
|
$this->updatePage = $updatePage; |
92
|
|
|
$this->historyPage = $historyPage; |
93
|
|
|
$this->notificationChecker = $notificationChecker; |
94
|
|
|
$this->sharedSecurityService = $sharedSecurityService; |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
/** |
98
|
|
|
* @Given I am browsing orders |
99
|
|
|
* @When I browse orders |
100
|
|
|
*/ |
101
|
|
|
public function iBrowseOrders() |
102
|
|
|
{ |
103
|
|
|
$this->indexPage->open(); |
104
|
|
|
} |
105
|
|
|
|
106
|
|
|
/** |
107
|
|
|
* @When I browse order's :order history |
108
|
|
|
*/ |
109
|
|
|
public function iBrowseOrderHistory(OrderInterface $order) |
110
|
|
|
{ |
111
|
|
|
$this->historyPage->open(['id' => $order->getId()]); |
112
|
|
|
} |
113
|
|
|
|
114
|
|
|
/** |
115
|
|
|
* @Given /^I am viewing the summary of (this order)$/ |
116
|
|
|
* @When I view the summary of the order :order |
117
|
|
|
*/ |
118
|
|
|
public function iSeeTheOrder(OrderInterface $order) |
119
|
|
|
{ |
120
|
|
|
$this->showPage->open(['id' => $order->getId()]); |
121
|
|
|
} |
122
|
|
|
|
123
|
|
|
/** |
124
|
|
|
* @When /^I mark (this order) as paid$/ |
125
|
|
|
*/ |
126
|
|
|
public function iMarkThisOrderAsAPaid(OrderInterface $order) |
127
|
|
|
{ |
128
|
|
|
$this->showPage->completeOrderLastPayment($order); |
129
|
|
|
} |
130
|
|
|
|
131
|
|
|
/** |
132
|
|
|
* @When /^I mark (this order)'s payment as refunded$/ |
133
|
|
|
*/ |
134
|
|
|
public function iMarkThisOrderSPaymentAsRefunded(OrderInterface $order) |
135
|
|
|
{ |
136
|
|
|
$this->showPage->refundOrderLastPayment($order); |
137
|
|
|
} |
138
|
|
|
|
139
|
|
|
/** |
140
|
|
|
* @When specify its tracking code as :trackingCode |
141
|
|
|
*/ |
142
|
|
|
public function specifyItsTrackingCodeAs($trackingCode) |
143
|
|
|
{ |
144
|
|
|
$this->showPage->specifyTrackingCode($trackingCode); |
145
|
|
|
$this->sharedStorage->set('tracking_code', $trackingCode); |
146
|
|
|
} |
147
|
|
|
|
148
|
|
|
/** |
149
|
|
|
* @When /^I ship (this order)$/ |
150
|
|
|
*/ |
151
|
|
|
public function iShipThisOrder(OrderInterface $order) |
152
|
|
|
{ |
153
|
|
|
$this->showPage->shipOrder($order); |
154
|
|
|
} |
155
|
|
|
|
156
|
|
|
/** |
157
|
|
|
* @When I switch the way orders are sorted by :fieldName |
158
|
|
|
*/ |
159
|
|
|
public function iSwitchSortingBy($fieldName) |
160
|
|
|
{ |
161
|
|
|
$this->indexPage->sortBy($fieldName); |
162
|
|
|
} |
163
|
|
|
|
164
|
|
|
/** |
165
|
|
|
* @When I specify filter date from as :dateTime |
166
|
|
|
*/ |
167
|
|
|
public function iSpecifyFilterDateFromAs($dateTime) |
168
|
|
|
{ |
169
|
|
|
$this->indexPage->specifyFilterDateFrom(new \DateTime($dateTime)); |
170
|
|
|
} |
171
|
|
|
|
172
|
|
|
/** |
173
|
|
|
* @When I specify filter date to as :dateTime |
174
|
|
|
*/ |
175
|
|
|
public function iSpecifyFilterDateToAs($dateTime) |
176
|
|
|
{ |
177
|
|
|
$this->indexPage->specifyFilterDateTo(new \DateTime($dateTime)); |
178
|
|
|
} |
179
|
|
|
|
180
|
|
|
/** |
181
|
|
|
* @When I choose :channelName as a channel filter |
182
|
|
|
*/ |
183
|
|
|
public function iChooseChannelAsAChannelFilter($channelName) |
184
|
|
|
{ |
185
|
|
|
$this->indexPage->chooseChannelFilter($channelName); |
186
|
|
|
} |
187
|
|
|
|
188
|
|
|
/** |
189
|
|
|
* @When I choose :currencyName as the filter currency |
190
|
|
|
*/ |
191
|
|
|
public function iChooseCurrencyAsTheFilterCurrency($currencyName) |
192
|
|
|
{ |
193
|
|
|
$this->indexPage->chooseCurrencyFilter($currencyName); |
194
|
|
|
} |
195
|
|
|
|
196
|
|
|
/** |
197
|
|
|
* @When I specify filter total being greater than :total |
198
|
|
|
*/ |
199
|
|
|
public function iSpecifyFilterTotalBeingGreaterThan($total) |
200
|
|
|
{ |
201
|
|
|
$this->indexPage->specifyFilterTotalGreaterThan($total); |
202
|
|
|
} |
203
|
|
|
|
204
|
|
|
/** |
205
|
|
|
* @When I specify filter total being less than :total |
206
|
|
|
*/ |
207
|
|
|
public function iSpecifyFilterTotalBeingLessThan($total) |
208
|
|
|
{ |
209
|
|
|
$this->indexPage->specifyFilterTotalLessThan($total); |
210
|
|
|
} |
211
|
|
|
|
212
|
|
|
/** |
213
|
|
|
* @When I filter |
214
|
|
|
*/ |
215
|
|
|
public function iFilter() |
216
|
|
|
{ |
217
|
|
|
$this->indexPage->filter(); |
218
|
|
|
} |
219
|
|
|
|
220
|
|
|
/** |
221
|
|
|
* @Then I should see a single order from customer :customer |
222
|
|
|
*/ |
223
|
|
|
public function iShouldSeeASingleOrderFromCustomer(CustomerInterface $customer) |
224
|
|
|
{ |
225
|
|
|
Assert::true( |
226
|
|
|
$this->indexPage->isSingleResourceOnPage(['customer' => $customer->getEmail()]), |
227
|
|
|
sprintf('Cannot find order for customer "%s" in the list.', $customer->getEmail()) |
228
|
|
|
); |
229
|
|
|
} |
230
|
|
|
|
231
|
|
|
/** |
232
|
|
|
* @Then it should have been placed by the customer :customerEmail |
233
|
|
|
*/ |
234
|
|
|
public function itShouldBePlacedByCustomer($customerEmail) |
235
|
|
|
{ |
236
|
|
|
Assert::true( |
237
|
|
|
$this->showPage->hasCustomer($customerEmail), |
238
|
|
|
sprintf('Cannot find customer "%s".', $customerEmail) |
239
|
|
|
); |
240
|
|
|
} |
241
|
|
|
|
242
|
|
|
/** |
243
|
|
|
* @Then it should be shipped to :customerName, :street, :postcode, :city, :countryName |
244
|
|
|
* @Then /^(this order) should (?:|still )be shipped to "([^"]+)", "([^"]+)", "([^"]+)", "([^"]+)", "([^"]+)"$/ |
245
|
|
|
*/ |
246
|
|
|
public function itShouldBeShippedTo( |
247
|
|
|
OrderInterface $order = null, |
248
|
|
|
$customerName, |
249
|
|
|
$street, |
250
|
|
|
$postcode, |
251
|
|
|
$city, |
252
|
|
|
$countryName |
253
|
|
|
) { |
254
|
|
|
if (null !== $order) { |
255
|
|
|
$this->iSeeTheOrder($order); |
256
|
|
|
} |
257
|
|
|
|
258
|
|
|
Assert::true( |
259
|
|
|
$this->showPage->hasShippingAddress($customerName, $street, $postcode, $city, $countryName), |
260
|
|
|
sprintf('Cannot find shipping address "%s, %s %s, %s".', $street, $postcode, $city, $countryName) |
261
|
|
|
); |
262
|
|
|
} |
263
|
|
|
|
264
|
|
|
/** |
265
|
|
|
* @Then it should be billed to :customerName, :street, :postcode, :city, :countryName |
266
|
|
|
* @Then the order should be billed to :customerName, :street, :postcode, :city, :countryName |
267
|
|
|
* @Then /^(this order) bill should (?:|still )be shipped to "([^"]+)", "([^"]+)", "([^"]+)", "([^"]+)", "([^"]+)"$/ |
268
|
|
|
*/ |
269
|
|
|
public function itShouldBeBilledTo( |
270
|
|
|
OrderInterface $order = null, |
271
|
|
|
$customerName, |
272
|
|
|
$street, |
273
|
|
|
$postcode, |
274
|
|
|
$city, |
275
|
|
|
$countryName |
276
|
|
|
) { |
277
|
|
|
if (null !== $order) { |
278
|
|
|
$this->iSeeTheOrder($order); |
279
|
|
|
} |
280
|
|
|
|
281
|
|
|
Assert::true( |
282
|
|
|
$this->showPage->hasBillingAddress($customerName, $street, $postcode, $city, $countryName), |
283
|
|
|
sprintf('Cannot find shipping address "%s, %s %s, %s".', $street, $postcode, $city, $countryName) |
284
|
|
|
); |
285
|
|
|
} |
286
|
|
|
|
287
|
|
|
/** |
288
|
|
|
* @Then it should be shipped via the :shippingMethodName shipping method |
289
|
|
|
*/ |
290
|
|
|
public function itShouldBeShippedViaShippingMethod($shippingMethodName) |
291
|
|
|
{ |
292
|
|
|
Assert::true( |
293
|
|
|
$this->showPage->hasShipment($shippingMethodName), |
294
|
|
|
sprintf('Cannot find shipment "%s".', $shippingMethodName) |
295
|
|
|
); |
296
|
|
|
} |
297
|
|
|
|
298
|
|
|
/** |
299
|
|
|
* @Then it should be paid with :paymentMethodName |
300
|
|
|
*/ |
301
|
|
|
public function itShouldBePaidWith($paymentMethodName) |
302
|
|
|
{ |
303
|
|
|
Assert::true( |
304
|
|
|
$this->showPage->hasPayment($paymentMethodName), |
305
|
|
|
sprintf('Cannot find payment "%s".', $paymentMethodName) |
306
|
|
|
); |
307
|
|
|
} |
308
|
|
|
|
309
|
|
|
/** |
310
|
|
|
* @Then /^it should have (\d+) items$/ |
311
|
|
|
* @Then I should see :amount orders in the list |
312
|
|
|
* @Then I should see a single order in the list |
313
|
|
|
*/ |
314
|
|
|
public function itShouldHaveAmountOfItems($amount = 1) |
315
|
|
|
{ |
316
|
|
|
$itemsCount = $this->showPage->countItems(); |
317
|
|
|
|
318
|
|
|
Assert::same( |
319
|
|
|
(int)$amount, |
320
|
|
|
$itemsCount, |
321
|
|
|
sprintf('There should be %d items, but get %d.', $amount, $itemsCount) |
322
|
|
|
); |
323
|
|
|
} |
324
|
|
|
|
325
|
|
|
/** |
326
|
|
|
* @Then the product named :productName should be in the items list |
327
|
|
|
*/ |
328
|
|
|
public function theProductShouldBeInTheItemsList($productName) |
329
|
|
|
{ |
330
|
|
|
Assert::true( |
331
|
|
|
$this->showPage->isProductInTheList($productName), |
332
|
|
|
sprintf('Product %s is not in the item list.', $productName) |
333
|
|
|
); |
334
|
|
|
} |
335
|
|
|
|
336
|
|
|
/** |
337
|
|
|
* @Then the order's items total should be :itemsTotal |
338
|
|
|
*/ |
339
|
|
|
public function theOrdersItemsTotalShouldBe($itemsTotal) |
340
|
|
|
{ |
341
|
|
|
$itemsTotalOnPage = $this->showPage->getItemsTotal(); |
342
|
|
|
|
343
|
|
|
Assert::eq( |
344
|
|
|
$itemsTotalOnPage, |
345
|
|
|
$itemsTotal, |
346
|
|
|
'Items total is %s, but should be %s.' |
347
|
|
|
); |
348
|
|
|
} |
349
|
|
|
|
350
|
|
|
/** |
351
|
|
|
* @Then /^the order's total should(?:| still) be "([^"]+)"$/ |
352
|
|
|
*/ |
353
|
|
|
public function theOrdersTotalShouldBe($total) |
354
|
|
|
{ |
355
|
|
|
$totalOnPage = $this->showPage->getTotal(); |
356
|
|
|
|
357
|
|
|
Assert::eq( |
358
|
|
|
$totalOnPage, |
359
|
|
|
$total, |
360
|
|
|
'Total is %s, but should be %s.' |
361
|
|
|
); |
362
|
|
|
} |
363
|
|
|
|
364
|
|
|
/** |
365
|
|
|
* @Then there should be a shipping charge :shippingCharge |
366
|
|
|
*/ |
367
|
|
|
public function theOrdersShippingChargesShouldBe($shippingCharge) |
368
|
|
|
{ |
369
|
|
|
Assert::true( |
370
|
|
|
$this->showPage->hasShippingCharge($shippingCharge), |
371
|
|
|
sprintf('Shipping charges is not "%s".', $shippingCharge) |
372
|
|
|
); |
373
|
|
|
} |
374
|
|
|
|
375
|
|
|
/** |
376
|
|
|
* @Then the order's shipping total should be :shippingTotal |
377
|
|
|
*/ |
378
|
|
|
public function theOrdersShippingTotalShouldBe($shippingTotal) |
379
|
|
|
{ |
380
|
|
|
$shippingTotalOnPage = $this->showPage->getShippingTotal(); |
381
|
|
|
|
382
|
|
|
Assert::eq( |
383
|
|
|
$shippingTotal, |
384
|
|
|
$shippingTotalOnPage, |
385
|
|
|
sprintf('Shipping total is "%s", but should be "%s".', $shippingTotalOnPage, $shippingTotal) |
386
|
|
|
); |
387
|
|
|
} |
388
|
|
|
|
389
|
|
|
/** |
390
|
|
|
* @Then the order's payment should (also) be :paymentAmount |
391
|
|
|
*/ |
392
|
|
|
public function theOrdersPaymentShouldBe($paymentAmount) |
393
|
|
|
{ |
394
|
|
|
$actualPaymentAmount = $this->showPage->getPaymentAmount(); |
395
|
|
|
|
396
|
|
|
Assert::eq($paymentAmount, $actualPaymentAmount); |
397
|
|
|
} |
398
|
|
|
|
399
|
|
|
/** |
400
|
|
|
* @Then the order should have tax :tax |
401
|
|
|
*/ |
402
|
|
|
public function theOrderShouldHaveTax($tax) |
403
|
|
|
{ |
404
|
|
|
Assert::true( |
405
|
|
|
$this->showPage->hasTax($tax), |
406
|
|
|
sprintf('Order should have tax "%s", but it does not.', $tax) |
407
|
|
|
); |
408
|
|
|
} |
409
|
|
|
|
410
|
|
|
/** |
411
|
|
|
* @Then /^the order's tax total should(?:| still) be "([^"]+)"$/ |
412
|
|
|
*/ |
413
|
|
|
public function theOrdersTaxTotalShouldBe($taxTotal) |
414
|
|
|
{ |
415
|
|
|
$taxTotalOnPage = $this->showPage->getTaxTotal(); |
416
|
|
|
|
417
|
|
|
Assert::eq( |
418
|
|
|
$taxTotal, |
419
|
|
|
$taxTotalOnPage, |
420
|
|
|
sprintf('Tax total is "%s", but should be "%s".', $taxTotalOnPage, $taxTotal) |
421
|
|
|
); |
422
|
|
|
} |
423
|
|
|
|
424
|
|
|
/** |
425
|
|
|
* @Then the order's promotion discount should be :promotionDiscount |
426
|
|
|
*/ |
427
|
|
|
public function theOrdersPromotionDiscountShouldBe($promotionDiscount) |
428
|
|
|
{ |
429
|
|
|
Assert::true( |
430
|
|
|
$this->showPage->hasPromotionDiscount($promotionDiscount), |
431
|
|
|
sprintf('Promotion discount is not "%s".', $promotionDiscount) |
432
|
|
|
); |
433
|
|
|
} |
434
|
|
|
|
435
|
|
|
/** |
436
|
|
|
* @Then the order's shipping promotion should be :promotion |
437
|
|
|
*/ |
438
|
|
|
public function theOrdersShippingPromotionDiscountShouldBe($promotionData) |
439
|
|
|
{ |
440
|
|
|
Assert::same($this->showPage->getShippingPromotionData(), $promotionData); |
441
|
|
|
} |
442
|
|
|
|
443
|
|
|
/** |
444
|
|
|
* @Then /^the order's promotion total should(?:| still) be "([^"]+)"$/ |
445
|
|
|
*/ |
446
|
|
|
public function theOrdersPromotionTotalShouldBe($promotionTotal) |
447
|
|
|
{ |
448
|
|
|
$promotionTotalOnPage = $this->showPage->getPromotionTotal(); |
449
|
|
|
|
450
|
|
|
Assert::eq( |
451
|
|
|
$promotionTotalOnPage, |
452
|
|
|
$promotionTotal, |
453
|
|
|
'Promotion total is %s, but should be %s.' |
454
|
|
|
); |
455
|
|
|
} |
456
|
|
|
|
457
|
|
|
/** |
458
|
|
|
* @When I check :itemName data |
459
|
|
|
*/ |
460
|
|
|
public function iCheckData($itemName) |
461
|
|
|
{ |
462
|
|
|
$this->sharedStorage->set('item', $itemName); |
463
|
|
|
} |
464
|
|
|
|
465
|
|
|
/** |
466
|
|
|
* @Then /^(its) code should be "([^"]+)"$/ |
467
|
|
|
*/ |
468
|
|
|
public function itemCodeShouldBe($itemName, $code) |
469
|
|
|
{ |
470
|
|
|
$itemCodeOnPage = $this->showPage->getItemCode($itemName); |
471
|
|
|
|
472
|
|
|
Assert::same( |
473
|
|
|
$itemCodeOnPage, |
474
|
|
|
$code, |
475
|
|
|
'Item code is %s, but should be %s.' |
476
|
|
|
); |
477
|
|
|
} |
478
|
|
|
|
479
|
|
|
/** |
480
|
|
|
* @Then /^(its) unit price should be ([^"]+)$/ |
481
|
|
|
*/ |
482
|
|
|
public function itemUnitPriceShouldBe($itemName, $unitPrice) |
483
|
|
|
{ |
484
|
|
|
$itemUnitPriceOnPage = $this->showPage->getItemUnitPrice($itemName); |
485
|
|
|
|
486
|
|
|
Assert::eq( |
487
|
|
|
$itemUnitPriceOnPage, |
488
|
|
|
$unitPrice, |
489
|
|
|
'Item unit price is %s, but should be %s.' |
490
|
|
|
); |
491
|
|
|
} |
492
|
|
|
|
493
|
|
|
/** |
494
|
|
|
* @Then /^(its) discounted unit price should be ([^"]+)$/ |
495
|
|
|
*/ |
496
|
|
|
public function itemDiscountedUnitPriceShouldBe($itemName, $discountedUnitPrice) |
497
|
|
|
{ |
498
|
|
|
$itemUnitPriceOnPage = $this->showPage->getItemDiscountedUnitPrice($itemName); |
499
|
|
|
|
500
|
|
|
Assert::eq( |
501
|
|
|
$itemUnitPriceOnPage, |
502
|
|
|
$discountedUnitPrice, |
503
|
|
|
'Item discounted unit price is %s, but should be %s.' |
504
|
|
|
); |
505
|
|
|
} |
506
|
|
|
|
507
|
|
|
/** |
508
|
|
|
* @Then /^(its) quantity should be ([^"]+)$/ |
509
|
|
|
*/ |
510
|
|
|
public function itemQuantityShouldBe($itemName, $quantity) |
511
|
|
|
{ |
512
|
|
|
$itemQuantityOnPage = $this->showPage->getItemQuantity($itemName); |
513
|
|
|
|
514
|
|
|
Assert::eq( |
515
|
|
|
$itemQuantityOnPage, |
516
|
|
|
$quantity, |
517
|
|
|
'Item quantity is %s, but should be %s.' |
518
|
|
|
); |
519
|
|
|
} |
520
|
|
|
|
521
|
|
|
/** |
522
|
|
|
* @Then /^(its) subtotal should be ([^"]+)$/ |
523
|
|
|
*/ |
524
|
|
|
public function itemSubtotalShouldBe($itemName, $subtotal) |
525
|
|
|
{ |
526
|
|
|
$itemSubtotalOnPage = $this->showPage->getItemSubtotal($itemName); |
527
|
|
|
|
528
|
|
|
Assert::eq( |
529
|
|
|
$itemSubtotalOnPage, |
530
|
|
|
$subtotal, |
531
|
|
|
'Item subtotal is %s, but should be %s.' |
532
|
|
|
); |
533
|
|
|
} |
534
|
|
|
|
535
|
|
|
/** |
536
|
|
|
* @Then /^(its) discount should be ([^"]+)$/ |
537
|
|
|
*/ |
538
|
|
|
public function theItemShouldHaveDiscount($itemName, $discount) |
539
|
|
|
{ |
540
|
|
|
$itemDiscountOnPage = $this->showPage->getItemDiscount($itemName); |
541
|
|
|
|
542
|
|
|
Assert::eq( |
543
|
|
|
$itemDiscountOnPage, |
544
|
|
|
$discount, |
545
|
|
|
'Item discount is %s, but should be %s.' |
546
|
|
|
); |
547
|
|
|
} |
548
|
|
|
|
549
|
|
|
/** |
550
|
|
|
* @Then /^(its) tax should be ([^"]+)$/ |
551
|
|
|
*/ |
552
|
|
|
public function itemTaxShouldBe($itemName, $tax) |
553
|
|
|
{ |
554
|
|
|
$itemTaxOnPage = $this->showPage->getItemTax($itemName); |
555
|
|
|
|
556
|
|
|
Assert::eq( |
557
|
|
|
$itemTaxOnPage, |
558
|
|
|
$tax, |
559
|
|
|
'Item tax is %s, but should be %s.' |
560
|
|
|
); |
561
|
|
|
} |
562
|
|
|
|
563
|
|
|
/** |
564
|
|
|
* @Then /^(its) total should be ([^"]+)$/ |
565
|
|
|
*/ |
566
|
|
|
public function itemTotalShouldBe($itemName, $total) |
567
|
|
|
{ |
568
|
|
|
$itemTotalOnPage = $this->showPage->getItemTotal($itemName); |
569
|
|
|
|
570
|
|
|
Assert::eq( |
571
|
|
|
$itemTotalOnPage, |
572
|
|
|
$total, |
573
|
|
|
'Item total is %s, but should be %s.' |
574
|
|
|
); |
575
|
|
|
} |
576
|
|
|
|
577
|
|
|
/** |
578
|
|
|
* @Then I should be notified that the order's payment has been successfully completed |
579
|
|
|
*/ |
580
|
|
|
public function iShouldBeNotifiedThatTheOrderSPaymentHasBeenSuccessfullyCompleted() |
581
|
|
|
{ |
582
|
|
|
$this |
583
|
|
|
->notificationChecker |
584
|
|
|
->checkNotification('Payment has been successfully updated.', NotificationType::success()); |
585
|
|
|
} |
586
|
|
|
|
587
|
|
|
/** |
588
|
|
|
* @Then I should be notified that the order's payment has been successfully refunded |
589
|
|
|
*/ |
590
|
|
|
public function iShouldBeNotifiedThatTheOrderSPaymentHasBeenSuccessfullyRefunded() |
591
|
|
|
{ |
592
|
|
|
$this |
593
|
|
|
->notificationChecker |
594
|
|
|
->checkNotification('Payment has been successfully refunded.', NotificationType::success()); |
595
|
|
|
} |
596
|
|
|
|
597
|
|
|
/** |
598
|
|
|
* @Then it should have payment state :paymentState |
599
|
|
|
* @Then it should have payment with state :paymentState |
600
|
|
|
*/ |
601
|
|
|
public function itShouldHavePaymentState($paymentState) |
602
|
|
|
{ |
603
|
|
|
Assert::true( |
604
|
|
|
$this->showPage->hasPayment($paymentState), |
605
|
|
|
sprintf('It should have payment with %s state', $paymentState) |
606
|
|
|
); |
607
|
|
|
} |
608
|
|
|
|
609
|
|
|
/** |
610
|
|
|
* @Then it should have order's payment state :orderPaymentState |
611
|
|
|
*/ |
612
|
|
|
public function itShouldHaveOrderPaymentState($orderPaymentState) |
613
|
|
|
{ |
614
|
|
|
Assert::same( |
615
|
|
|
$this->showPage->getPaymentState(), |
616
|
|
|
$orderPaymentState, |
617
|
|
|
'Order payment state should be %2$s, but it is %s.' |
618
|
|
|
); |
619
|
|
|
} |
620
|
|
|
|
621
|
|
|
/** |
622
|
|
|
* @Then it's payment state should be refunded |
623
|
|
|
*/ |
624
|
|
|
public function orderPaymentStateShouldBeRefunded() |
625
|
|
|
{ |
626
|
|
|
Assert::same( |
627
|
|
|
$this->showPage->getPaymentState(), |
628
|
|
|
'Refunded', |
629
|
|
|
'Order payment state should be refunded, but it is not.' |
630
|
|
|
); |
631
|
|
|
} |
632
|
|
|
|
633
|
|
|
/** |
634
|
|
|
* @Then /^I should not be able to mark (this order) as paid again$/ |
635
|
|
|
*/ |
636
|
|
|
public function iShouldNotBeAbleToFinalizeItsPayment(OrderInterface $order) |
637
|
|
|
{ |
638
|
|
|
Assert::false( |
639
|
|
|
$this->showPage->canCompleteOrderLastPayment($order), |
640
|
|
|
'It should not have complete payment button.' |
641
|
|
|
); |
642
|
|
|
} |
643
|
|
|
|
644
|
|
|
/** |
645
|
|
|
* @Then I should be notified that the order has been successfully shipped |
646
|
|
|
*/ |
647
|
|
|
public function iShouldBeNotifiedThatTheOrderHasBeenSuccessfullyShipped() |
648
|
|
|
{ |
649
|
|
|
$this->notificationChecker->checkNotification( |
650
|
|
|
'Shipment has been successfully updated.', |
651
|
|
|
NotificationType::success() |
652
|
|
|
); |
653
|
|
|
} |
654
|
|
|
|
655
|
|
|
/** |
656
|
|
|
* @Then /^I should not be able to ship (this order)$/ |
657
|
|
|
*/ |
658
|
|
|
public function iShouldNotBeAbleToShipThisOrder(OrderInterface $order) |
659
|
|
|
{ |
660
|
|
|
Assert::false( |
661
|
|
|
$this->showPage->canShipOrder($order), |
662
|
|
|
'It should not have ship shipment button.' |
663
|
|
|
); |
664
|
|
|
} |
665
|
|
|
|
666
|
|
|
/** |
667
|
|
|
* @When I cancel this order |
668
|
|
|
*/ |
669
|
|
|
public function iCancelThisOrder() |
670
|
|
|
{ |
671
|
|
|
$this->showPage->cancelOrder(); |
672
|
|
|
} |
673
|
|
|
|
674
|
|
|
/** |
675
|
|
|
* @Then I should be notified that it has been successfully updated |
676
|
|
|
*/ |
677
|
|
|
public function iShouldBeNotifiedAboutItHasBeenSuccessfullyCanceled() |
678
|
|
|
{ |
679
|
|
|
$this->notificationChecker->checkNotification( |
680
|
|
|
'Order has been successfully updated.', |
681
|
|
|
NotificationType::success() |
682
|
|
|
); |
683
|
|
|
} |
684
|
|
|
|
685
|
|
|
/** |
686
|
|
|
* @Then I should not be able to cancel this order |
687
|
|
|
*/ |
688
|
|
|
public function iShouldNotBeAbleToCancelThisOrder() |
689
|
|
|
{ |
690
|
|
|
Assert::false( |
691
|
|
|
$this->showPage->hasCancelButton(), |
692
|
|
|
'There should not be a cancel button, but it is.' |
693
|
|
|
); |
694
|
|
|
} |
695
|
|
|
|
696
|
|
|
/** |
697
|
|
|
* @Then this order should have state :state |
698
|
|
|
* @Then its state should be :state |
699
|
|
|
*/ |
700
|
|
|
public function itsStateShouldBe($state) |
701
|
|
|
{ |
702
|
|
|
Assert::same( |
703
|
|
|
$this->showPage->getOrderState(), |
704
|
|
|
$state, |
705
|
|
|
'The order state should be %2$s, but it is %s.' |
706
|
|
|
); |
707
|
|
|
} |
708
|
|
|
|
709
|
|
|
/** |
710
|
|
|
* @Then it should( still) have a :state state |
711
|
|
|
*/ |
712
|
|
|
public function itShouldHaveState($state) |
713
|
|
|
{ |
714
|
|
|
Assert::true( |
715
|
|
|
$this->indexPage->isSingleResourceOnPage(['state' => $state]), |
716
|
|
|
sprintf('Cannot find order with "%s" state in the list.', $state) |
717
|
|
|
); |
718
|
|
|
} |
719
|
|
|
|
720
|
|
|
/** |
721
|
|
|
* @Then /^(the administrator) should know about (this additional note) for (this order made by "[^"]+")$/ |
722
|
|
|
*/ |
723
|
|
|
public function theCustomerServiceShouldKnowAboutThisAdditionalNotes( |
724
|
|
|
AdminUserInterface $user, |
725
|
|
|
$note, |
726
|
|
|
OrderInterface $order |
727
|
|
|
) { |
728
|
|
|
$this->sharedSecurityService->performActionAsAdminUser( |
729
|
|
|
$user, |
730
|
|
|
function () use ($note, $order) { |
731
|
|
|
$this->showPage->open(['id' => $order->getId()]); |
732
|
|
|
Assert::true($this->showPage->hasNote($note), sprintf('I should see %s note, but I do not see', $note)); |
733
|
|
|
} |
734
|
|
|
); |
735
|
|
|
} |
736
|
|
|
|
737
|
|
|
/** |
738
|
|
|
* @Then I should see an order with :orderNumber number |
739
|
|
|
*/ |
740
|
|
|
public function iShouldSeeOrderWithNumber($orderNumber) |
741
|
|
|
{ |
742
|
|
|
Assert::true( |
743
|
|
|
$this->indexPage->isSingleResourceOnPage(['number' => $orderNumber]), |
744
|
|
|
sprintf('Cannot find order with "%s" number in the list.', $orderNumber) |
745
|
|
|
); |
746
|
|
|
} |
747
|
|
|
|
748
|
|
|
/** |
749
|
|
|
* @Then I should not see an order with :orderNumber number |
750
|
|
|
*/ |
751
|
|
|
public function iShouldNotSeeOrderWithNumber($orderNumber) |
752
|
|
|
{ |
753
|
|
|
Assert::false( |
754
|
|
|
$this->indexPage->isSingleResourceOnPage(['number' => $orderNumber]), |
755
|
|
|
sprintf('Order with "%s" number should not be in the list.', $orderNumber) |
756
|
|
|
); |
757
|
|
|
} |
758
|
|
|
|
759
|
|
|
/** |
760
|
|
|
* @Then I should not see any orders with currency :currencyCode |
761
|
|
|
*/ |
762
|
|
|
public function iShouldNotSeeAnyOrderWithCurrency($currencyCode) |
763
|
|
|
{ |
764
|
|
|
Assert::false( |
765
|
|
|
$this->indexPage->isSingleResourceOnPage(['currencyCode' => $currencyCode]), |
766
|
|
|
sprintf('Order with currency "%s" should not be on the list.', $currencyCode) |
767
|
|
|
); |
768
|
|
|
} |
769
|
|
|
|
770
|
|
|
/** |
771
|
|
|
* @Then the first order should have number :number |
772
|
|
|
*/ |
773
|
|
|
public function theFirstOrderShouldHaveNumber($number) |
774
|
|
|
{ |
775
|
|
|
$actualNumber = $this->indexPage->getColumnFields('number')[0]; |
776
|
|
|
|
777
|
|
|
Assert::eq( |
778
|
|
|
$actualNumber, |
779
|
|
|
$number, |
780
|
|
|
sprintf('Expected first order\'s number to be %s, but it is %s.', $number, $actualNumber) |
781
|
|
|
); |
782
|
|
|
} |
783
|
|
|
|
784
|
|
|
/** |
785
|
|
|
* @Then it should have shipment in state :shipmentState |
786
|
|
|
*/ |
787
|
|
|
public function itShouldHaveShipmentState($shipmentState) |
788
|
|
|
{ |
789
|
|
|
Assert::true( |
790
|
|
|
$this->showPage->hasShipment($shipmentState), |
791
|
|
|
sprintf('It should have shipment with %s state', $shipmentState) |
792
|
|
|
); |
793
|
|
|
} |
794
|
|
|
|
795
|
|
|
/** |
796
|
|
|
* @Then order :orderNumber should have shipment state :shippingState |
797
|
|
|
*/ |
798
|
|
|
public function thisOrderShipmentStateShouldBe($shippingState) |
799
|
|
|
{ |
800
|
|
|
Assert::true( |
801
|
|
|
$this->indexPage->isSingleResourceOnPage(['shippingState' => $shippingState]), |
802
|
|
|
sprintf('Order should have %s shipping state', $shippingState) |
803
|
|
|
); |
804
|
|
|
} |
805
|
|
|
|
806
|
|
|
/** |
807
|
|
|
* @Then the order :order should have order payment state :orderPaymentState |
808
|
|
|
* @Then /^(this order) should have order payment state "([^"]+)"$/ |
809
|
|
|
*/ |
810
|
|
|
public function theOrderShouldHavePaymentState(OrderInterface $order, $orderPaymentState) |
|
|
|
|
811
|
|
|
{ |
812
|
|
|
Assert::true( |
813
|
|
|
$this->indexPage->isSingleResourceOnPage(['paymentState' => $orderPaymentState]), |
814
|
|
|
sprintf('Cannot find order with "%s" order payment state in the list.', $orderPaymentState) |
815
|
|
|
); |
816
|
|
|
} |
817
|
|
|
|
818
|
|
|
/** |
819
|
|
|
* @Then /^(this order) should have order shipping state "([^"]+)"$/ |
820
|
|
|
*/ |
821
|
|
|
public function theOrderShouldHaveShipmentState(OrderInterface $order, $orderShipmentState) |
|
|
|
|
822
|
|
|
{ |
823
|
|
|
Assert::true( |
824
|
|
|
$this->indexPage->isSingleResourceOnPage(['shippingState' => $orderShipmentState]), |
825
|
|
|
sprintf('Cannot find order with "%s" order shipping state on the list.', $orderShipmentState) |
826
|
|
|
); |
827
|
|
|
} |
828
|
|
|
|
829
|
|
|
/** |
830
|
|
|
* @Then /^there should be(?:| only) (\d+) payments?$/ |
831
|
|
|
*/ |
832
|
|
|
public function theOrderShouldHaveNumberOfPayments($number) |
833
|
|
|
{ |
834
|
|
|
$actualNumberOfPayments = $this->showPage->getPaymentsCount(); |
835
|
|
|
|
836
|
|
|
Assert::same((int)$number, $actualNumberOfPayments); |
837
|
|
|
} |
838
|
|
|
|
839
|
|
|
/** |
840
|
|
|
* @Then I should see the order :orderNumber with total :total |
841
|
|
|
*/ |
842
|
|
|
public function iShouldSeeTheOrderWithTotal($orderNumber, $total) |
843
|
|
|
{ |
844
|
|
|
Assert::true( |
845
|
|
|
$this->indexPage->isSingleResourceOnPage(['total' => $total]), |
846
|
|
|
sprintf('The total of order "%s" is not "%s".', $orderNumber, $total) |
847
|
|
|
); |
848
|
|
|
} |
849
|
|
|
|
850
|
|
|
/** |
851
|
|
|
* @When /^I want to modify a customer's (?:billing|shipping) address of (this order)$/ |
852
|
|
|
*/ |
853
|
|
|
public function iWantToModifyACustomerSShippingAddress(OrderInterface $order) |
854
|
|
|
{ |
855
|
|
|
$this->updatePage->open(['id' => $order->getId()]); |
856
|
|
|
} |
857
|
|
|
|
858
|
|
|
/** |
859
|
|
|
* @When I save my changes |
860
|
|
|
* @When I try to save my changes |
861
|
|
|
*/ |
862
|
|
|
public function iSaveMyChanges() |
863
|
|
|
{ |
864
|
|
|
$this->updatePage->saveChanges(); |
865
|
|
|
} |
866
|
|
|
|
867
|
|
|
/** |
868
|
|
|
* @When /^I specify their (?:|new )shipping (address as "([^"]+)", "([^"]+)", "([^"]+)", "([^"]+)" for "([^"]+)")$/ |
869
|
|
|
*/ |
870
|
|
|
public function iSpecifyTheirShippingAddressAsFor(AddressInterface $address) |
871
|
|
|
{ |
872
|
|
|
$this->updatePage->specifyShippingAddress($address); |
873
|
|
|
} |
874
|
|
|
|
875
|
|
|
/** |
876
|
|
|
* @When /^I specify their (?:|new )billing (address as "([^"]+)", "([^"]+)", "([^"]+)", "([^"]+)" for "([^"]+)")$/ |
877
|
|
|
*/ |
878
|
|
|
public function iSpecifyTheirBillingAddressAsFor(AddressInterface $address) |
879
|
|
|
{ |
880
|
|
|
$this->updatePage->specifyBillingAddress($address); |
881
|
|
|
} |
882
|
|
|
|
883
|
|
|
/** |
884
|
|
|
* @Then /^I should be notified that the "([^"]+)", the "([^"]+)", the "([^"]+)" and the "([^"]+)" in (shipping|billing) details are required$/ |
885
|
|
|
*/ |
886
|
|
|
public function iShouldBeNotifiedThatTheAndTheInShippingDetailsAreRequired($firstElement, $secondElement, $thirdElement, $fourthElement, $type) |
887
|
|
|
{ |
888
|
|
|
$this->assertElementValidationMessage($type, $firstElement, sprintf('Please enter %s.', $firstElement)); |
889
|
|
|
$this->assertElementValidationMessage($type, $secondElement, sprintf('Please enter %s.', $secondElement)); |
890
|
|
|
$this->assertElementValidationMessage($type, $thirdElement, sprintf('Please enter %s.', $thirdElement)); |
891
|
|
|
$this->assertElementValidationMessage($type, $fourthElement, sprintf('Please enter %s.', $fourthElement)); |
892
|
|
|
} |
893
|
|
|
|
894
|
|
|
/** |
895
|
|
|
* @Then I should see :provinceName as province in the shipping address |
896
|
|
|
*/ |
897
|
|
|
public function iShouldSeeAsProvinceInTheShippingAddress($provinceName) |
898
|
|
|
{ |
899
|
|
|
Assert::true( |
900
|
|
|
$this->showPage->hasShippingProvinceName($provinceName), |
901
|
|
|
sprintf('Cannot find shipping address with province %s', $provinceName) |
902
|
|
|
); |
903
|
|
|
} |
904
|
|
|
|
905
|
|
|
/** |
906
|
|
|
* @Then I should see :provinceName ad province in the billing address |
907
|
|
|
*/ |
908
|
|
|
public function iShouldSeeAdProvinceInTheBillingAddress($provinceName) |
909
|
|
|
{ |
910
|
|
|
Assert::true( |
911
|
|
|
$this->showPage->hasBillingProvinceName($provinceName), |
912
|
|
|
sprintf('Cannot find shipping address with province %s', $provinceName) |
913
|
|
|
); |
914
|
|
|
} |
915
|
|
|
|
916
|
|
|
/** |
917
|
|
|
* @Then /^(the administrator) should know about IP address of (this order made by "[^"]+")$/ |
918
|
|
|
*/ |
919
|
|
|
public function theAdministratorShouldKnowAboutIPAddressOfThisOrderMadeBy( |
920
|
|
|
AdminUserInterface $user, |
921
|
|
|
OrderInterface $order |
922
|
|
|
) { |
923
|
|
|
$this->sharedSecurityService->performActionAsAdminUser( |
924
|
|
|
$user, |
925
|
|
|
function () use ($order) { |
926
|
|
|
$this->showPage->open(['id' => $order->getId()]); |
927
|
|
|
|
928
|
|
|
Assert::notSame( |
929
|
|
|
$this->showPage->getIpAddressAssigned(), |
930
|
|
|
'', |
931
|
|
|
'There should be IP address assigned to order, but there is not.' |
932
|
|
|
); |
933
|
|
|
} |
934
|
|
|
); |
935
|
|
|
} |
936
|
|
|
|
937
|
|
|
/** |
938
|
|
|
* @When /^I (clear old billing address) information$/ |
939
|
|
|
*/ |
940
|
|
|
public function iSpecifyTheBillingAddressAs(AddressInterface $address) |
941
|
|
|
{ |
942
|
|
|
$this->updatePage->specifyBillingAddress($address); |
943
|
|
|
} |
944
|
|
|
|
945
|
|
|
/** |
946
|
|
|
* @When /^I (clear old shipping address) information$/ |
947
|
|
|
*/ |
948
|
|
|
public function iSpecifyTheShippingAddressAs(AddressInterface $address) |
949
|
|
|
{ |
950
|
|
|
$this->updatePage->specifyShippingAddress($address); |
951
|
|
|
} |
952
|
|
|
|
953
|
|
|
/** |
954
|
|
|
* @When /^I do not specify new information$/ |
955
|
|
|
*/ |
956
|
|
|
public function iDoNotSpecifyNewInformation() |
957
|
|
|
{ |
958
|
|
|
// Intentionally left blank to fulfill context expectation |
959
|
|
|
} |
960
|
|
|
|
961
|
|
|
/** |
962
|
|
|
* @Then /^(the administrator) should see that (order placed by "[^"]+") has "([^"]+)" currency$/ |
963
|
|
|
*/ |
964
|
|
|
public function theAdministratorShouldSeeThatThisOrderHasBeenPlacedIn(AdminUserInterface $user, OrderInterface $order, $currency) |
965
|
|
|
{ |
966
|
|
|
$this->sharedSecurityService->performActionAsAdminUser($user, function () use ($order, $currency) { |
967
|
|
|
$this->showPage->open(['id' => $order->getId()]); |
968
|
|
|
Assert::same( |
969
|
|
|
$this->showPage->getOrderCurrency(), |
970
|
|
|
$currency, |
971
|
|
|
'The order has been placed in %s, but it was expected to be placed in %s' |
972
|
|
|
); |
973
|
|
|
}); |
974
|
|
|
} |
975
|
|
|
|
976
|
|
|
/** |
977
|
|
|
* @Then /^(the administrator) should see the order with total "([^"]+)" in order list$/ |
978
|
|
|
*/ |
979
|
|
|
public function theAdministratorShouldSeeTheOrderWithTotalInOrderList(AdminUserInterface $user, $total) |
980
|
|
|
{ |
981
|
|
|
$this->sharedSecurityService->performActionAsAdminUser($user, function () use ($total) { |
982
|
|
|
$this->indexPage->open(); |
983
|
|
|
|
984
|
|
|
Assert::true( |
985
|
|
|
$this->indexPage->isSingleResourceOnPage(['total' => $total]), |
986
|
|
|
sprintf('The order with total "%s" has not been found.', $total) |
987
|
|
|
); |
988
|
|
|
}); |
989
|
|
|
} |
990
|
|
|
|
991
|
|
|
/** |
992
|
|
|
* @Then there should be :count changes in the registry |
993
|
|
|
*/ |
994
|
|
|
public function thereShouldBeCountChangesInTheRegistry($count) |
995
|
|
|
{ |
996
|
|
|
Assert::same( |
997
|
|
|
(int) $count, |
998
|
|
|
$this->historyPage->countShippingAddressChanges() |
999
|
|
|
); |
1000
|
|
|
} |
1001
|
|
|
|
1002
|
|
|
/** |
1003
|
|
|
* @Then I should not be able to refund this payment |
1004
|
|
|
*/ |
1005
|
|
|
public function iShouldNotBeAbleToRefundThisPayment() |
1006
|
|
|
{ |
1007
|
|
|
Assert::false($this->showPage->hasRefundButton()); |
1008
|
|
|
} |
1009
|
|
|
|
1010
|
|
|
/** |
1011
|
|
|
* @Then I should not see information about payments |
1012
|
|
|
*/ |
1013
|
|
|
public function iShouldNotSeeInformationAboutPayments() |
1014
|
|
|
{ |
1015
|
|
|
Assert::same( |
1016
|
|
|
0, |
1017
|
|
|
$this->showPage->getPaymentsCount(), |
1018
|
|
|
'There should be no payments, but they are.' |
1019
|
|
|
); |
1020
|
|
|
} |
1021
|
|
|
|
1022
|
|
|
/** |
1023
|
|
|
* @param string $type |
1024
|
|
|
* @param string $element |
1025
|
|
|
* @param string $expectedMessage |
1026
|
|
|
* |
1027
|
|
|
* @throws \InvalidArgumentException |
1028
|
|
|
*/ |
1029
|
|
|
private function assertElementValidationMessage($type, $element, $expectedMessage) |
1030
|
|
|
{ |
1031
|
|
|
$element = sprintf('%s_%s', $type, implode('_', explode(' ', $element))); |
1032
|
|
|
Assert::true( |
1033
|
|
|
$this->updatePage->checkValidationMessageFor($element, $expectedMessage), |
1034
|
|
|
sprintf('The %s should be required.', $element) |
1035
|
|
|
); |
1036
|
|
|
} |
1037
|
|
|
} |
1038
|
|
|
|
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.