Completed
Push — master ( 047880...b09c02 )
by Kamil
92:08 queued 74:48
created

iShouldBeNotifiedThatPercentageDiscountShouldBeBetween()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
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
declare(strict_types=1);
13
14
namespace Sylius\Behat\Context\Ui\Admin;
15
16
use Behat\Behat\Context\Context;
17
use Sylius\Behat\NotificationType;
18
use Sylius\Behat\Page\Admin\Crud\IndexPageInterface as IndexPageCouponInterface;
19
use Sylius\Behat\Page\Admin\Promotion\CreatePageInterface;
20
use Sylius\Behat\Page\Admin\Promotion\IndexPageInterface;
21
use Sylius\Behat\Page\Admin\Promotion\UpdatePageInterface;
22
use Sylius\Behat\Service\NotificationCheckerInterface;
23
use Sylius\Behat\Service\Resolver\CurrentPageResolverInterface;
24
use Sylius\Behat\Service\SharedStorageInterface;
25
use Sylius\Component\Core\Model\PromotionInterface;
26
use Webmozart\Assert\Assert;
27
28
final class ManagingPromotionsContext implements Context
29
{
30
    /** @var SharedStorageInterface */
31
    private $sharedStorage;
32
33
    /** @var IndexPageInterface */
34
    private $indexPage;
35
36
    /** @var IndexPageCouponInterface */
37
    private $indexCouponPage;
38
39
    /** @var CreatePageInterface */
40
    private $createPage;
41
42
    /** @var UpdatePageInterface */
43
    private $updatePage;
44
45
    /** @var CurrentPageResolverInterface */
46
    private $currentPageResolver;
47
48
    /** @var NotificationCheckerInterface */
49
    private $notificationChecker;
50
51
    public function __construct(
52
        SharedStorageInterface $sharedStorage,
53
        IndexPageInterface $indexPage,
54
        IndexPageCouponInterface $indexCouponPage,
55
        CreatePageInterface $createPage,
56
        UpdatePageInterface $updatePage,
57
        CurrentPageResolverInterface $currentPageResolver,
58
        NotificationCheckerInterface $notificationChecker
59
    ) {
60
        $this->sharedStorage = $sharedStorage;
61
        $this->indexPage = $indexPage;
62
        $this->indexCouponPage = $indexCouponPage;
63
        $this->createPage = $createPage;
64
        $this->updatePage = $updatePage;
65
        $this->currentPageResolver = $currentPageResolver;
66
        $this->notificationChecker = $notificationChecker;
67
    }
68
69
    /**
70
     * @When I create a new promotion
71
     * @When I want to create a new promotion
72
     */
73
    public function iWantToCreateANewPromotion(): void
74
    {
75
        $this->createPage->open();
76
    }
77
78
    /**
79
     * @Given I want to browse promotions
80
     * @When I browse promotions
81
     */
82
    public function iWantToBrowsePromotions()
83
    {
84
        $this->indexPage->open();
85
    }
86
87
    /**
88
     * @When I specify its code as :code
89
     * @When I do not specify its code
90
     */
91
    public function iSpecifyItsCodeAs($code = null)
92
    {
93
        $this->createPage->specifyCode($code ?? '');
94
    }
95
96
    /**
97
     * @When I name it :name
98
     * @When I do not name it
99
     * @When I remove its name
100
     */
101
    public function iNameIt($name = null)
102
    {
103
        $this->createPage->nameIt($name ?? '');
104
    }
105
106
    /**
107
     * @When I remove its priority
108
     */
109
    public function iRemoveItsPriority()
110
    {
111
        $this->updatePage->setPriority(null);
112
    }
113
114
    /**
115
     * @Then I should see the promotion :promotionName in the list
116
     * @Then the :promotionName promotion should appear in the registry
117
     * @Then the :promotionName promotion should exist in the registry
118
     * @Then this promotion should still be named :promotionName
119
     * @Then promotion :promotionName should still exist in the registry
120
     */
121
    public function thePromotionShouldAppearInTheRegistry(string $promotionName): void
122
    {
123
        $this->indexPage->open();
124
125
        Assert::true($this->indexPage->isSingleResourceOnPage(['name' => $promotionName]));
126
    }
127
128
    /**
129
     * @When I add it
130
     * @When I try to add it
131
     */
132
    public function iAddIt()
133
    {
134
        $this->createPage->create();
135
    }
136
137
    /**
138
     * @When I add the "Has at least one from taxons" rule configured with :firstTaxon
139
     * @When I add the "Has at least one from taxons" rule configured with :firstTaxon and :secondTaxon
140
     */
141
    public function iAddTheHasTaxonRuleConfiguredWith(...$taxons)
142
    {
143
        $this->createPage->addRule('Has at least one from taxons');
144
145
        $this->createPage->selectAutocompleteRuleOption('Taxons', $taxons, true);
146
    }
147
148
    /**
149
     * @When /^I add the "Total price of items from taxon" rule configured with "([^"]+)" taxon and (?:€|£|\$)([^"]+) amount for "([^"]+)" channel$/
150
     */
151
    public function iAddTheRuleConfiguredWith($taxonName, $amount, $channelName)
152
    {
153
        $this->createPage->addRule('Total price of items from taxon');
154
        $this->createPage->selectAutocompleteRuleOption('Taxon', $taxonName);
155
        $this->createPage->fillRuleOptionForChannel($channelName, 'Amount', $amount);
156
    }
157
158
    /**
159
     * @When /^I add the "Item total" rule configured with (?:€|£|\$)([^"]+) amount for "([^"]+)" channel and (?:€|£|\$)([^"]+) amount for "([^"]+)" channel$/
160
     */
161
    public function iAddTheItemTotalRuleConfiguredWithTwoChannel(
162
        $firstAmount,
163
        $firstChannelName,
164
        $secondAmount,
165
        $secondChannelName
166
    ) {
167
        $this->createPage->addRule('Item total');
168
        $this->createPage->fillRuleOptionForChannel($firstChannelName, 'Amount', $firstAmount);
169
        $this->createPage->fillRuleOptionForChannel($secondChannelName, 'Amount', $secondAmount);
170
    }
171
172
    /**
173
     * @When /^I add the "([^"]+)" action configured with amount of "(?:€|£|\$)([^"]+)" for "([^"]+)" channel$/
174
     */
175
    public function iAddTheActionConfiguredWithAmountForChannel($actionType, $amount, $channelName)
176
    {
177
        $this->createPage->addAction($actionType);
178
        $this->createPage->fillActionOptionForChannel($channelName, 'Amount', $amount);
179
    }
180
181
    /**
182
     * @When /^it is(?:| also) configured with amount of "(?:€|£|\$)([^"]+)" for "([^"]+)" channel$/
183
     */
184
    public function itIsConfiguredWithAmountForChannel($amount, $channelName)
185
    {
186
        $this->createPage->fillActionOptionForChannel($channelName, 'Amount', $amount);
187
    }
188
189
    /**
190
     * @When /^I specify that on "([^"]+)" channel this action should be applied to items with price greater then "(?:€|£|\$)([^"]+)"$/
191
     */
192
    public function iAddAMinPriceFilterRangeForChannel($channelName, $minimum)
193
    {
194
        $this->createPage->fillActionOptionForChannel($channelName, 'Min', $minimum);
195
    }
196
197
    /**
198
     * @When /^I specify that on "([^"]+)" channel this action should be applied to items with price lesser then "(?:€|£|\$)([^"]+)"$/
199
     */
200
    public function iAddAMaxPriceFilterRangeForChannel($channelName, $maximum)
201
    {
202
        $this->createPage->fillActionOptionForChannel($channelName, 'Max', $maximum);
203
    }
204
205
    /**
206
     * @When /^I specify that on "([^"]+)" channel this action should be applied to items with price between "(?:€|£|\$)([^"]+)" and "(?:€|£|\$)([^"]+)"$/
207
     */
208
    public function iAddAMinMaxPriceFilterRangeForChannel($channelName, $minimum, $maximum)
209
    {
210
        $this->iAddAMinPriceFilterRangeForChannel($channelName, $minimum);
211
        $this->iAddAMaxPriceFilterRangeForChannel($channelName, $maximum);
212
    }
213
214
    /**
215
     * @When I specify that this action should be applied to items from :taxonName category
216
     */
217
    public function iSpecifyThatThisActionShouldBeAppliedToItemsFromCategory($taxonName)
218
    {
219
        $this->createPage->selectAutoCompleteFilterOption('Taxons', $taxonName);
220
    }
221
222
    /**
223
     * @When /^I add the "([^"]+)" action configured with a percentage value of (?:|-)([^"]+)% for ("[^"]+") channel$/
224
     */
225
    public function iAddTheActionConfiguredWithAPercentageValueForChannel(
226
        string $actionType,
227
        string $percentage = null,
228
        string $channelName
229
    ): void {
230
        $this->createPage->addAction($actionType);
231
        $this->createPage->fillActionOptionForChannel($channelName, 'Percentage', $percentage);
232
    }
233
234
    /**
235
     * @When /^I add the "([^"]+)" action configured with a percentage value of (?:|-)([^"]+)%$/
236
     * @When I add the :actionType action configured without a percentage value
237
     */
238
    public function iAddTheActionConfiguredWithAPercentageValue($actionType, $percentage = null)
239
    {
240
        $this->createPage->addAction($actionType);
241
        $this->createPage->fillActionOption('Percentage', $percentage ?? '');
242
    }
243
244
    /**
245
     * @When I add the "Customer group" rule for :customerGroupName group
246
     */
247
    public function iAddTheCustomerGroupRuleConfiguredForGroup($customerGroupName)
248
    {
249
        $this->createPage->addRule('Customer group');
250
        $this->createPage->selectRuleOption('Customer group', $customerGroupName);
251
    }
252
253
    /**
254
     * @When I check (also) the :promotionName promotion
255
     */
256
    public function iCheckThePromotion(string $promotionName): void
257
    {
258
        $this->indexPage->checkResourceOnPage(['name' => $promotionName]);
259
    }
260
261
    /**
262
     * @When I delete them
263
     */
264
    public function iDeleteThem(): void
265
    {
266
        $this->indexPage->bulkDelete();
267
    }
268
269
    /**
270
     * @Then I should see a single promotion in the list
271
     * @Then there should be :amount promotions
272
     */
273
    public function thereShouldBePromotion(int $amount = 1): void
274
    {
275
        Assert::same($amount, $this->indexPage->countItems());
276
    }
277
278
    /**
279
     * @Then /^(this promotion) should be coupon based$/
280
     */
281
    public function thisPromotionShouldBeCouponBased(PromotionInterface $promotion)
282
    {
283
        Assert::true($this->indexPage->isCouponBasedFor($promotion));
284
    }
285
286
    /**
287
     * @Then /^I should be able to manage coupons for (this promotion)$/
288
     */
289
    public function iShouldBeAbleToManageCouponsForThisPromotion(PromotionInterface $promotion)
290
    {
291
        Assert::true($this->indexPage->isAbleToManageCouponsFor($promotion));
292
    }
293
294
    /**
295
     * @Then I should be notified that :element is required
296
     */
297
    public function iShouldBeNotifiedThatIsRequired($element)
298
    {
299
        $this->assertFieldValidationMessage($element, sprintf('Please enter promotion %s.', $element));
300
    }
301
302
    /**
303
     * @Then I should be notified that a :element value should be a numeric value
304
     */
305
    public function iShouldBeNotifiedThatAMinimalValueShouldBeNumeric($element)
306
    {
307
        $this->assertFieldValidationMessage($element, 'This value is not valid.');
308
    }
309
310
    /**
311
     * @Then I should be notified that promotion with this code already exists
312
     */
313
    public function iShouldBeNotifiedThatPromotionWithThisCodeAlreadyExists()
314
    {
315
        Assert::same($this->createPage->getValidationMessage('code'), 'The promotion with given code already exists.');
316
    }
317
318
    /**
319
     * @Then promotion with :element :name should not be added
320
     */
321
    public function promotionWithElementValueShouldNotBeAdded($element, $name)
322
    {
323
        $this->indexPage->open();
324
325
        Assert::false($this->indexPage->isSingleResourceOnPage([$element => $name]));
326
    }
327
328
    /**
329
     * @Then there should still be only one promotion with :element :value
330
     */
331
    public function thereShouldStillBeOnlyOnePromotionWith($element, $value)
332
    {
333
        $this->indexPage->open();
334
335
        Assert::true($this->indexPage->isSingleResourceOnPage([$element => $value]));
336
    }
337
338
    /**
339
     * @When I set its usage limit to :usageLimit
340
     */
341
    public function iSetItsUsageLimitTo($usageLimit)
342
    {
343
        /** @var CreatePageInterface|UpdatePageInterface $currentPage */
344
        $currentPage = $this->currentPageResolver->getCurrentPageWithForm([$this->createPage, $this->updatePage]);
345
346
        $currentPage->fillUsageLimit($usageLimit);
347
    }
348
349
    /**
350
     * @Then the :promotion promotion should be available to be used only :usageLimit times
351
     */
352
    public function thePromotionShouldBeAvailableToUseOnlyTimes(PromotionInterface $promotion, $usageLimit)
353
    {
354
        $this->iWantToModifyAPromotion($promotion);
355
356
        Assert::true($this->updatePage->hasResourceValues(['usage_limit' => $usageLimit]));
357
    }
358
359
    /**
360
     * @When I make it exclusive
361
     */
362
    public function iMakeItExclusive()
363
    {
364
        /** @var CreatePageInterface|UpdatePageInterface $currentPage */
365
        $currentPage = $this->currentPageResolver->getCurrentPageWithForm([$this->createPage, $this->updatePage]);
366
367
        $currentPage->makeExclusive();
368
    }
369
370
    /**
371
     * @Then the :promotion promotion should be exclusive
372
     */
373
    public function thePromotionShouldBeExclusive(PromotionInterface $promotion)
374
    {
375
        $this->assertIfFieldIsTrue($promotion, 'exclusive');
376
    }
377
378
    /**
379
     * @When I make it coupon based
380
     */
381
    public function iMakeItCouponBased()
382
    {
383
        /** @var CreatePageInterface|UpdatePageInterface $currentPage */
384
        $currentPage = $this->currentPageResolver->getCurrentPageWithForm([$this->createPage, $this->updatePage]);
385
386
        $currentPage->checkCouponBased();
387
    }
388
389
    /**
390
     * @Then the :promotion promotion should be coupon based
391
     */
392
    public function thePromotionShouldBeCouponBased(PromotionInterface $promotion)
393
    {
394
        $this->assertIfFieldIsTrue($promotion, 'coupon_based');
395
    }
396
397
    /**
398
     * @When I make it applicable for the :channelName channel
399
     */
400
    public function iMakeItApplicableForTheChannel($channelName)
401
    {
402
        /** @var CreatePageInterface|UpdatePageInterface $currentPage */
403
        $currentPage = $this->currentPageResolver->getCurrentPageWithForm([$this->createPage, $this->updatePage]);
404
405
        $currentPage->checkChannel($channelName);
406
    }
407
408
    /**
409
     * @Then the :promotion promotion should be applicable for the :channelName channel
410
     */
411
    public function thePromotionShouldBeApplicableForTheChannel(PromotionInterface $promotion, $channelName)
412
    {
413
        $this->iWantToModifyAPromotion($promotion);
414
415
        Assert::true($this->updatePage->checkChannelsState($channelName));
416
    }
417
418
    /**
419
     * @Given I want to modify a :promotion promotion
420
     * @Given /^I want to modify (this promotion)$/
421
     * @When I modify a :promotion promotion
422
     */
423
    public function iWantToModifyAPromotion(PromotionInterface $promotion): void
424
    {
425
        $this->updatePage->open(['id' => $promotion->getId()]);
426
    }
427
428
    /**
429
     * @Then the code field should be disabled
430
     */
431
    public function theCodeFieldShouldBeDisabled()
432
    {
433
        Assert::true($this->updatePage->isCodeDisabled());
434
    }
435
436
    /**
437
     * @When I save my changes
438
     * @When I try to save my changes
439
     */
440
    public function iSaveMyChanges()
441
    {
442
        $this->updatePage->saveChanges();
443
    }
444
445
    /**
446
     * @When /^I delete a ("([^"]+)" promotion)$/
447
     * @When /^I try to delete a ("([^"]+)" promotion)$/
448
     */
449
    public function iDeletePromotion(PromotionInterface $promotion)
450
    {
451
        $this->sharedStorage->set('promotion', $promotion);
452
453
        $this->indexPage->open();
454
        $this->indexPage->deleteResourceOnPage(['name' => $promotion->getName()]);
455
    }
456
457
    /**
458
     * @Then /^(this promotion) should no longer exist in the promotion registry$/
459
     */
460
    public function promotionShouldNotExistInTheRegistry(PromotionInterface $promotion)
461
    {
462
        $this->indexPage->open();
463
464
        Assert::false($this->indexPage->isSingleResourceOnPage(['code' => $promotion->getCode()]));
465
    }
466
467
    /**
468
     * @Then I should be notified that it is in use and cannot be deleted
469
     */
470
    public function iShouldBeNotifiedOfFailure()
471
    {
472
        $this->notificationChecker->checkNotification(
473
            'Cannot delete, the promotion is in use.',
474
            NotificationType::failure()
475
        );
476
    }
477
478
    /**
479
     * @When I make it available from :startsDate to :endsDate
480
     */
481
    public function iMakeItAvailableFromTo(\DateTimeInterface $startsDate, \DateTimeInterface $endsDate)
482
    {
483
        /** @var CreatePageInterface|UpdatePageInterface $currentPage */
484
        $currentPage = $this->currentPageResolver->getCurrentPageWithForm([$this->createPage, $this->updatePage]);
485
486
        $currentPage->setStartsAt($startsDate);
487
        $currentPage->setEndsAt($endsDate);
488
    }
489
490
    /**
491
     * @Then the :promotion promotion should be available from :startsDate to :endsDate
492
     */
493
    public function thePromotionShouldBeAvailableFromTo(PromotionInterface $promotion, \DateTimeInterface $startsDate, \DateTimeInterface $endsDate)
494
    {
495
        $this->iWantToModifyAPromotion($promotion);
496
497
        Assert::true($this->updatePage->hasStartsAt($startsDate));
498
499
        Assert::true($this->updatePage->hasEndsAt($endsDate));
500
    }
501
502
    /**
503
     * @Then I should be notified that promotion cannot end before it start
504
     */
505
    public function iShouldBeNotifiedThatPromotionCannotEndBeforeItsEvenStart()
506
    {
507
        /** @var CreatePageInterface|UpdatePageInterface $currentPage */
508
        $currentPage = $this->currentPageResolver->getCurrentPageWithForm([$this->createPage, $this->updatePage]);
509
510
        Assert::same($currentPage->getValidationMessage('ends_at'), 'End date cannot be set prior start date.');
511
    }
512
513
    /**
514
     * @Then I should be notified that this value should not be blank
515
     */
516
    public function iShouldBeNotifiedThatThisValueShouldNotBeBlank()
517
    {
518
        Assert::same(
519
            $this->createPage->getValidationMessageForAction(),
520
            'This value should not be blank.'
521
        );
522
    }
523
524
    /**
525
     * @Then I should be notified that a percentage discount value must be at least 0%
526
     * @Then I should be notified that the maximum value of a percentage discount is 100%
527
     */
528
    public function iShouldBeNotifiedThatPercentageDiscountShouldBeBetween(): void
529
    {
530
        Assert::same(
531
            $this->createPage->getValidationMessageForAction(),
532
            'The percentage discount must be between 0% and 100%.'
533
        );
534
    }
535
536
    /**
537
     * @Then the promotion :promotion should be used :usage time(s)
538
     * @Then the promotion :promotion should not be used
539
     */
540
    public function thePromotionShouldBeUsedTime(PromotionInterface $promotion, $usage = 0)
541
    {
542
        Assert::same(
543
            (int) $usage,
544
            $this->indexPage->getUsageNumber($promotion),
545
            'Promotion should be used %s times, but is %2$s.'
546
        );
547
    }
548
549
    /**
550
     * @When I add the "Contains product" rule configured with the :productName product
551
     */
552
    public function iAddTheRuleConfiguredWithTheProduct($productName)
553
    {
554
        $this->createPage->addRule('Contains product');
555
        $this->createPage->selectAutocompleteRuleOption('Product code', $productName);
556
    }
557
558
    /**
559
     * @When I specify that this action should be applied to the :productName product
560
     */
561
    public function iSpecifyThatThisActionShouldBeAppliedToTheProduct($productName)
562
    {
563
        $this->createPage->selectAutoCompleteFilterOption('Products', $productName);
564
    }
565
566
    /**
567
     * @Then I should see :count promotions on the list
568
     */
569
    public function iShouldSeePromotionsOnTheList($count)
570
    {
571
        $actualCount = $this->indexPage->countItems();
572
573
        Assert::same(
574
            (int) $count,
575
            $actualCount,
576
            'There should be %s promotion, but there\'s %2$s.'
577
        );
578
    }
579
580
    /**
581
     * @Then the first promotion on the list should have :field :value
582
     */
583
    public function theFirstPromotionOnTheListShouldHave($field, $value)
584
    {
585
        $fields = $this->indexPage->getColumnFields($field);
586
        $actualValue = reset($fields);
587
588
        Assert::same(
589
            $actualValue,
590
            $value,
591
            sprintf('Expected first promotion\'s %s to be "%s", but it is "%s".', $field, $value, $actualValue)
592
        );
593
    }
594
595
    /**
596
     * @Then the last promotion on the list should have :field :value
597
     */
598
    public function theLastPromotionOnTheListShouldHave($field, $value)
599
    {
600
        $fields = $this->indexPage->getColumnFields($field);
601
        $actualValue = end($fields);
602
603
        Assert::same(
604
            $actualValue,
605
            $value,
606
            sprintf('Expected last promotion\'s %s to be "%s", but it is "%s".', $field, $value, $actualValue)
607
        );
608
    }
609
610
    /**
611
     * @Given the :promotion promotion should have priority :priority
612
     */
613
    public function thePromotionsShouldHavePriority(PromotionInterface $promotion, int $priority)
614
    {
615
        $this->iWantToModifyAPromotion($promotion);
616
617
        Assert::same($this->updatePage->getPriority(), $priority);
618
    }
619
620
    /**
621
     * @When I want to manage this promotion coupons
622
     */
623
    public function iWantToManageThisPromotionSCoupons(): void
624
    {
625
        $this->updatePage->manageCoupons();
626
    }
627
628
    /**
629
     * @Then I should not be able to access coupons management page
630
     */
631
    public function iShouldNotBeAbleToAccessCouponsManagementPage(): void
632
    {
633
        Assert::false($this->updatePage->isCouponManagementAvailable());
634
    }
635
636
    /**
637
     * @Then /^I should be on (this promotion)'s coupons management page$/
638
     */
639
    public function iShouldBeOnThisPromotionSCouponsManagementPage(PromotionInterface $promotion): void
640
    {
641
        Assert::true($this->indexCouponPage->isOpen(['promotionId' => $promotion->getId()]));
642
    }
643
644
    /**
645
     * @Then I should be able to modify a :promotion promotion
646
     */
647
    public function iShouldBeAbleToModifyAPromotion(PromotionInterface $promotion): void
648
    {
649
        $this->iWantToModifyAPromotion($promotion);
650
        $this->updatePage->saveChanges();
651
    }
652
653
    /**
654
     * @Then the :promotion promotion should have :ruleName rule configured
655
     */
656
    public function thePromotionShouldHaveRuleConfigured(PromotionInterface $promotion, string $ruleName): void
657
    {
658
        $this->iWantToModifyAPromotion($promotion);
659
        $this->updatePage->saveChanges();
660
661
        Assert::true($this->updatePage->hasRule($ruleName));
662
    }
663
664
    /**
665
     * @Then the :promotion promotion should not have any rule configured
666
     */
667
    public function thePromotionShouldNotHaveAnyRuleConfigured(PromotionInterface $promotion): void
668
    {
669
        $this->iWantToModifyAPromotion($promotion);
670
671
        Assert::false($this->updatePage->hasAnyRule());
672
    }
673
674
    /**
675
     * @param string $element
676
     * @param string $expectedMessage
677
     */
678
    private function assertFieldValidationMessage($element, $expectedMessage)
679
    {
680
        /** @var CreatePageInterface|UpdatePageInterface $currentPage */
681
        $currentPage = $this->currentPageResolver->getCurrentPageWithForm([$this->createPage, $this->updatePage]);
682
683
        Assert::same($currentPage->getValidationMessage($element), $expectedMessage);
684
    }
685
686
    /**
687
     * @param string $field
688
     */
689
    private function assertIfFieldIsTrue(PromotionInterface $promotion, $field)
690
    {
691
        $this->iWantToModifyAPromotion($promotion);
692
693
        Assert::true($this->updatePage->hasResourceValues([$field => 1]));
694
    }
695
}
696