Completed
Push — unused-definitions ( d9908f )
by Kamil
18:33
created

ManagingCustomersContext::iRemoveItsLastName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
nc 1
cc 1
eloc 2
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
namespace Sylius\Behat\Context\Ui\Admin;
13
14
use Behat\Behat\Context\Context;
15
use Sylius\Behat\Page\Admin\Crud\IndexPageInterface;
16
use Sylius\Behat\Page\Admin\Customer\CreatePageInterface;
17
use Sylius\Behat\Page\Admin\Customer\ShowPageInterface;
18
use Sylius\Behat\Page\Admin\Customer\UpdatePageInterface;
19
use Sylius\Behat\Service\Resolver\CurrentPageResolverInterface;
20
use Sylius\Behat\Service\SharedStorageInterface;
21
use Sylius\Component\Core\Model\CustomerInterface;
22
use Webmozart\Assert\Assert;
23
24
/**
25
 * @author Anna Walasek <[email protected]>
26
 */
27
final class ManagingCustomersContext implements Context
28
{
29
    /**
30
     * @var SharedStorageInterface
31
     */
32
    private $sharedStorage;
33
34
    /**
35
     * @var IndexPageInterface
36
     */
37
    private $indexPage;
38
39
    /**
40
     * @var CreatePageInterface
41
     */
42
    private $createPage;
43
44
    /**
45
     * @var UpdatePageInterface
46
     */
47
    private $updatePage;
48
49
    /**
50
     * @var ShowPageInterface
51
     */
52
    private $showPage;
53
54
    /**
55
     * @var IndexPageInterface
56
     */
57
    private $ordersIndexPage;
58
59
    /**
60
     * @var CurrentPageResolverInterface
61
     */
62
    private $currentPageResolver;
63
64
    /**
65
     * @param SharedStorageInterface $sharedStorage
66
     * @param CreatePageInterface $createPage
67
     * @param IndexPageInterface $indexPage
68
     * @param UpdatePageInterface $updatePage
69
     * @param ShowPageInterface $showPage
70
     * @param IndexPageInterface $ordersIndexPage
71
     * @param CurrentPageResolverInterface $currentPageResolver
72
     */
73
    public function __construct(
74
        SharedStorageInterface $sharedStorage,
75
        CreatePageInterface $createPage,
76
        IndexPageInterface $indexPage,
77
        UpdatePageInterface $updatePage,
78
        ShowPageInterface $showPage,
79
        IndexPageInterface $ordersIndexPage,
80
        CurrentPageResolverInterface $currentPageResolver
81
    ) {
82
        $this->sharedStorage = $sharedStorage;
83
        $this->createPage = $createPage;
84
        $this->indexPage = $indexPage;
85
        $this->updatePage = $updatePage;
86
        $this->showPage = $showPage;
87
        $this->ordersIndexPage = $ordersIndexPage;
88
        $this->currentPageResolver = $currentPageResolver;
89
    }
90
91
    /**
92
     * @Given I want to create a new customer
93
     * @Given I want to create a new customer account
94
     */
95
    public function iWantToCreateANewCustomer()
96
    {
97
        $this->createPage->open();
98
    }
99
100
    /**
101
     * @When /^I specify (?:their|his) first name as "([^"]*)"$/
102
     */
103
    public function iSpecifyItsFirstNameAs($name)
104
    {
105
        $this->createPage->specifyFirstName($name);
106
    }
107
108
    /**
109
     * @When /^I specify (?:their|his) last name as "([^"]*)"$/
110
     */
111
    public function iSpecifyItsLastNameAs($name)
112
    {
113
        $this->createPage->specifyLastName($name);
114
    }
115
116
    /**
117
     * @When I specify their email as :name
118
     * @When I do not specify their email
119
     */
120
    public function iSpecifyItsEmailAs($email = null)
121
    {
122
        $this->createPage->specifyEmail($email);
123
    }
124
125
    /**
126
     * @When I add them
127
     * @When I try to add them
128
     */
129
    public function iAddIt()
130
    {
131
        $this->createPage->create();
132
    }
133
134
    /**
135
     * @Then the customer :customer should appear in the store
136
     * @Then the customer :customer should still have this email
137
     */
138
    public function theCustomerShould(CustomerInterface $customer)
139
    {
140
        $this->indexPage->open();
141
142
        Assert::true(
143
            $this->indexPage->isSingleResourceOnPage(['email' => $customer->getEmail()]),
144
            sprintf('Customer with email %s should exist but it does not.', $customer->getEmail())
145
        );
146
    }
147
148
    /**
149
     * @When I select :gender as its gender
150
     */
151
    public function iSelectGender($gender)
152
    {
153
        $this->createPage->chooseGender($gender);
154
    }
155
156
    /**
157
     * @When I select :group as their group
158
     */
159
    public function iSelectGroup($group)
160
    {
161
        $this->createPage->chooseGroup($group);
162
    }
163
164
    /**
165
     * @When I specify its birthday as :birthday
166
     */
167
    public function iSpecifyItsBirthdayAs($birthday)
168
    {
169
        $this->createPage->specifyBirthday($birthday);
170
    }
171
172
    /**
173
     * @Given /^I want to edit (this customer)$/
174
     */
175
    public function iWantToEditThisCustomer(CustomerInterface $customer)
176
    {
177
        $this->updatePage->open(['id' => $customer->getId()]);
178
    }
179
180
    /**
181
     * @When I save my changes
182
     * @When I try to save my changes
183
     */
184
    public function iSaveMyChanges()
185
    {
186
        $this->updatePage->saveChanges();
187
    }
188
189
    /**
190
     * @Then /^(this customer) with name "([^"]*)" should appear in the store$/
191
     */
192
    public function theCustomerWithNameShouldAppearInTheRegistry(CustomerInterface $customer, $name)
193
    {
194
        $this->updatePage->open(['id' => $customer->getId()]);
195
196
        Assert::eq(
197
            $name,
198
            $this->updatePage->getFullName(),
199
            sprintf('Customer should have name %s, but they have %s.', $name, $this->updatePage->getFullName())
200
        );
201
    }
202
203
    /**
204
     * @When I want to see all customers in store
205
     */
206
    public function iWantToSeeAllCustomersInStore()
207
    {
208
        $this->indexPage->open();
209
    }
210
211
    /**
212
     * @Then /^I should see (\d+) customers in the list$/
213
     */
214
    public function iShouldSeeCustomersInTheList($amountOfCustomers)
215
    {
216
        Assert::same(
217
            (int) $amountOfCustomers,
218
            $this->indexPage->countItems(),
219
            sprintf('Amount of customers should be equal %s, but is not.', $amountOfCustomers)
220
        );
221
    }
222
223
    /**
224
     * @Then I should see the customer :email in the list
225
     */
226
    public function iShouldSeeTheCustomerInTheList($email)
227
    {
228
        Assert::true(
229
            $this->indexPage->isSingleResourceOnPage(['email' => $email]),
230
            sprintf('Customer with email %s should exist but it does not.', $email)
231
        );
232
    }
233
234
    /**
235
     * @Then /^I should be notified that ([^"]+) is required$/
236
     */
237
    public function iShouldBeNotifiedThatFirstNameIsRequired($elementName)
238
    {
239
        Assert::same($this->createPage->getValidationMessage($elementName), sprintf('Please enter your %s.', $elementName));
240
    }
241
242
    /**
243
     * @Then /^I should be notified that ([^"]+) should be ([^"]+)$/
244
     */
245
    public function iShouldBeNotifiedThatTheElementShouldBe($elementName, $validationMessage)
246
    {
247
        Assert::same(
248
            $this->updatePage->getValidationMessage($elementName),
249
            sprintf('%s must be %s.', ucfirst($elementName), $validationMessage)
250
        );
251
    }
252
253
    /**
254
     * @Then the customer with email :email should not appear in the store
255
     */
256
    public function theCustomerShouldNotAppearInTheStore($email)
257
    {
258
        $this->indexPage->open();
259
260
        Assert::false(
261
            $this->indexPage->isSingleResourceOnPage(['email' => $email]),
262
            sprintf('Customer with email %s was created, but it should not.', $email)
263
        );
264
    }
265
266
    /**
267
     * @When I remove its first name
268
     */
269
    public function iRemoveItsFirstName()
270
    {
271
        $this->updatePage->changeFirstName('');
272
    }
273
274
    /**
275
     * @Then /^(this customer) should have an empty first name$/
276
     * @Then the customer :customer should still have an empty first name
277
     */
278
    public function theCustomerShouldStillHaveAnEmptyFirstName(CustomerInterface $customer)
279
    {
280
        $this->updatePage->open(['id' => $customer->getId()]);
281
282
        Assert::eq(
283
            '',
284
            $this->updatePage->getFirstName(),
285
            'Customer should have an empty first name, but it does not.'
286
        );
287
    }
288
289
    /**
290
     * @When I remove its last name
291
     */
292
    public function iRemoveItsLastName()
293
    {
294
        $this->updatePage->changeLastName('');
295
    }
296
297
    /**
298
     * @Then /^(this customer) should have an empty last name$/
299
     * @Then the customer :customer should still have an empty last name
300
     */
301
    public function theCustomerShouldStillHaveAnEmptyLastName(CustomerInterface $customer)
302
    {
303
        $this->updatePage->open(['id' => $customer->getId()]);
304
305
        Assert::eq(
306
            '',
307
            $this->updatePage->getLastName(),
308
            'Customer should have an empty last name, but it does not.'
309
        );
310
    }
311
312
    /**
313
     * @When I remove its email
314
     */
315
    public function iRemoveItsEmail()
316
    {
317
        $this->updatePage->changeEmail('');
318
    }
319
320
    /**
321
     * @Then I should be notified that email is not valid
322
     */
323
    public function iShouldBeNotifiedThatEmailIsNotValid()
324
    {
325
        Assert::same($this->createPage->getValidationMessage('email'), 'This email is invalid.');
326
    }
327
328
    /**
329
     * @Then I should be notified that email must be unique
330
     */
331
    public function iShouldBeNotifiedThatEmailMustBeUnique()
332
    {
333
        Assert::same($this->createPage->getValidationMessage('email'), 'This email is already used.');
334
    }
335
336
    /**
337
     * @Then there should still be only one customer with email :email
338
     */
339
    public function thereShouldStillBeOnlyOneCustomerWithEmail($email)
340
    {
341
        $this->indexPage->open();
342
343
        Assert::true(
344
            $this->indexPage->isSingleResourceOnPage(['email' => $email]),
345
            sprintf('Customer with email %s cannot be found.', $email)
346
        );
347
    }
348
349
    /**
350
     * @Given I want to enable :customer
351
     * @Given I want to disable :customer
352
     */
353
    public function iWantToChangeStatusOf(CustomerInterface $customer)
354
    {
355
        $this->updatePage->open(['id' => $customer->getId()]);
356
    }
357
358
    /**
359
     * @When I enable their account
360
     */
361
    public function iEnableIt()
362
    {
363
        $this->updatePage->enable();
364
    }
365
366
    /**
367
     * @When I disable their account
368
     */
369
    public function iDisableIt()
370
    {
371
        $this->updatePage->disable();
372
    }
373
374
    /**
375
     * @Then /^(this customer) should be enabled$/
376
     */
377
    public function thisCustomerShouldBeEnabled(CustomerInterface $customer)
378
    {
379
        $this->indexPage->open();
380
381
        Assert::eq(
382
            'Enabled',
383
            $this->indexPage->getCustomerAccountStatus($customer),
0 ignored issues
show
Bug introduced by
It seems like you code against a concrete implementation and not the interface Sylius\Behat\Page\Admin\Crud\IndexPageInterface as the method getCustomerAccountStatus() does only exist in the following implementations of said interface: Sylius\Behat\Page\Admin\Customer\IndexPage.

Let’s take a look at an example:

interface User
{
    /** @return string */
    public function getPassword();
}

class MyUser implements User
{
    public function getPassword()
    {
        // return something
    }

    public function getDisplayName()
    {
        // return some name.
    }
}

class AuthSystem
{
    public function authenticate(User $user)
    {
        $this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
        // do something.
    }
}

In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break.

Available Fixes

  1. Change the type-hint for the parameter:

    class AuthSystem
    {
        public function authenticate(MyUser $user) { /* ... */ }
    }
    
  2. Add an additional type-check:

    class AuthSystem
    {
        public function authenticate(User $user)
        {
            if ($user instanceof MyUser) {
                $this->logger->info(/** ... */);
            }
    
            // or alternatively
            if ( ! $user instanceof MyUser) {
                throw new \LogicException(
                    '$user must be an instance of MyUser, '
                   .'other instances are not supported.'
                );
            }
    
        }
    }
    
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types inside the if block in such a case.
  1. Add the method to the interface:

    interface User
    {
        /** @return string */
        public function getPassword();
    
        /** @return string */
        public function getDisplayName();
    }
    
Loading history...
384
            'Customer account should be enabled, but it does not.'
385
        );
386
    }
387
388
    /**
389
     * @Then /^(this customer) should be disabled$/
390
     */
391
    public function thisCustomerShouldBeDisabled(CustomerInterface $customer)
392
    {
393
        $this->indexPage->open();
394
395
        Assert::eq(
396
            'Disabled',
397
            $this->indexPage->getCustomerAccountStatus($customer),
0 ignored issues
show
Bug introduced by
It seems like you code against a concrete implementation and not the interface Sylius\Behat\Page\Admin\Crud\IndexPageInterface as the method getCustomerAccountStatus() does only exist in the following implementations of said interface: Sylius\Behat\Page\Admin\Customer\IndexPage.

Let’s take a look at an example:

interface User
{
    /** @return string */
    public function getPassword();
}

class MyUser implements User
{
    public function getPassword()
    {
        // return something
    }

    public function getDisplayName()
    {
        // return some name.
    }
}

class AuthSystem
{
    public function authenticate(User $user)
    {
        $this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
        // do something.
    }
}

In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break.

Available Fixes

  1. Change the type-hint for the parameter:

    class AuthSystem
    {
        public function authenticate(MyUser $user) { /* ... */ }
    }
    
  2. Add an additional type-check:

    class AuthSystem
    {
        public function authenticate(User $user)
        {
            if ($user instanceof MyUser) {
                $this->logger->info(/** ... */);
            }
    
            // or alternatively
            if ( ! $user instanceof MyUser) {
                throw new \LogicException(
                    '$user must be an instance of MyUser, '
                   .'other instances are not supported.'
                );
            }
    
        }
    }
    
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types inside the if block in such a case.
  1. Add the method to the interface:

    interface User
    {
        /** @return string */
        public function getPassword();
    
        /** @return string */
        public function getDisplayName();
    }
    
Loading history...
398
            'Customer account should be disabled, but it does not.'
399
        );
400
    }
401
402
    /**
403
     * @When I specify their password as :password
404
     */
405
    public function iSpecifyItsPasswordAs($password)
406
    {
407
        $this->createPage->specifyPassword($password);
408
    }
409
410
    /**
411
     * @When I choose create account option
412
     */
413
    public function iChooseCreateAccountOption()
414
    {
415
        $this->createPage->selectCreateAccount();
416
    }
417
418
    /**
419
     * @When I browse orders of a customer :customer
420
     */
421
    public function iBrowseOrdersOfACustomer(CustomerInterface $customer)
422
    {
423
        $this->ordersIndexPage->open(['id' => $customer->getId()]);
424
    }
425
426
    /**
427
     * @Then the customer :customer should have an account created
428
     * @Then /^(this customer) should have an account created$/
429
     */
430
    public function theyShouldHaveAnAccountCreated(CustomerInterface $customer)
431
    {
432
        Assert::notNull(
433
            $customer->getUser()->getPassword(),
434
            'Customer should have an account, but they do not.'
435
        );
436
    }
437
438
    /**
439
     * @When I view details of the customer :customer
440
     * @When /^I view (their) details$/
441
     */
442
    public function iViewDetailsOfTheCustomer(CustomerInterface $customer)
443
    {
444
        $this->showPage->open(['id' => $customer->getId()]);
445
    }
446
447
    /**
448
     * @Then his name should be :name
449
     */
450
    public function hisNameShouldBe($name)
451
    {
452
        Assert::same(
453
            $name,
454
            $this->showPage->getCustomerName(),
455
            'Customer name should be "%s", but it is not.'
456
        );
457
    }
458
459
    /**
460
     * @Given he should be registered since :registrationDate
461
     */
462
    public function hisRegistrationDateShouldBe($registrationDate)
463
    {
464
        Assert::eq(
465
            new \DateTime($registrationDate),
466
            $this->showPage->getRegistrationDate(),
467
            'Customer registration date should be "%s", but it is not.'
468
        );
469
    }
470
471
    /**
472
     * @Given his email should be :email
473
     */
474
    public function hisEmailShouldBe($email)
475
    {
476
        Assert::same(
477
            $email,
478
            $this->showPage->getCustomerEmail(),
479
            'Customer email should be "%s", but it is not'
480
        );
481
    }
482
483
    /**
484
     * @Then his default address should be :defaultAddress
485
     */
486
    public function hisShippingAddressShouldBe($defaultAddress)
487
    {
488
        Assert::same(
489
            str_replace(',', '', $defaultAddress),
490
            $this->showPage->getDefaultAddress(),
491
            'Customer\'s default address should be "%s", but it is not.'
492
        );
493
    }
494
495
    /**
496
     * @Then I should see information about no existing account for this customer
497
     */
498
    public function iShouldSeeInformationAboutNoExistingAccountForThisCustomer()
499
    {
500
        Assert::true(
501
            $this->showPage->hasAccount(),
502
            'There should be information about no account, but there is none.'
503
        );
504
    }
505
506
    /**
507
     * @Then I should see that this customer is subscribed to the newsletter
508
     */
509
    public function iShouldSeeThatThisCustomerIsSubscribedToTheNewsletter()
510
    {
511
        Assert::true(
512
            $this->showPage->isSubscribedToNewsletter(),
513
            'There should be information that this customer is subscribed to the newsletter.'
514
        );
515
    }
516
517
    /**
518
     * @Then I should not see information about email verification
519
     */
520
    public function iShouldSeeInformationAboutEmailVerification()
521
    {
522
        Assert::true(
523
            $this->showPage->hasEmailVerificationInformation(),
524
            'There should be no information about email verification.'
525
        );
526
    }
527
528
    /**
529
     * @When I make them subscribed to the newsletter
530
     */
531
    public function iMakeThemSubscribedToTheNewsletter()
532
    {
533
        $this->updatePage->subscribeToTheNewsletter();
534
    }
535
536
    /**
537
     * @When I change the password of user :customer to :newPassword
538
     */
539
    public function iChangeThePasswordOfUserTo(CustomerInterface $customer, $newPassword)
540
    {
541
        $this->updatePage->open(['id' => $customer->getId()]);
542
        $this->updatePage->changePassword($newPassword);
543
        $this->updatePage->saveChanges();
544
    }
545
546
    /**
547
     * @Then this customer should be subscribed to the newsletter
548
     */
549
    public function thisCustomerShouldBeSubscribedToTheNewsletter()
550
    {
551
        Assert::true(
552
            $this->updatePage->isSubscribedToTheNewsletter(),
553
            'This customer should subscribe to the newsletter.'
554
        );
555
    }
556
557
    /**
558
     * @Then the province in the default address should be :provinceName
559
     */
560
    public function theProvinceInTheDefaultAddressShouldBe($provinceName)
561
    {
562
        Assert::true(
563
            $this->showPage->hasDefaultAddressProvinceName($provinceName),
564
            sprintf('Cannot find shipping address with province %s', $provinceName)
565
        );
566
    }
567
568
    /**
569
     * @Then this customer should have :groupName as their group
570
     */
571
    public function thisCustomerShouldHaveAsTheirGroup($groupName)
572
    {
573
        /** @var UpdatePageInterface|ShowPageInterface $currentPage */
574
        $currentPage = $this->currentPageResolver->getCurrentPageWithForm([$this->updatePage, $this->showPage]);
0 ignored issues
show
Documentation introduced by
array($this->updatePage, $this->showPage) is of type array<integer,object<Syl...\\ShowPageInterface>"}>, but the function expects a array<integer,object<Syl...\SymfonyPageInterface>>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
575
576
        Assert::same(
577
            $groupName,
578
            $currentPage->getGroupName(),
579
            sprintf('Customer should have %s as group, but it does not.', $groupName)
580
        );
581
    }
582
583
    /**
584
     * @Then I should see that this customer has verified the email
585
     */
586
    public function iShouldSeeThatThisCustomerHasVerifiedTheEmail()
587
    {
588
        Assert::true(
589
            $this->showPage->hasVerifiedEmail(),
590
            'There should be information that this customer has verified the email.'
591
        );
592
    }
593
594
    /**
595
     * @Then I should see a single order in the list
596
     */
597
    public function iShouldSeeASingleOrderInTheList()
598
    {
599
        Assert::same(
600
            1,
601
            $this->ordersIndexPage->countItems(),
602
            'Cannot find order in the list.'
603
        );
604
    }
605
606
    /**
607
     * @Then I should see the order with number :orderNumber in the list
608
     */
609
    public function iShouldSeeASingleOrderFromCustomer($orderNumber)
610
    {
611
        Assert::true(
612
            $this->indexPage->isSingleResourceOnPage(['number' => $orderNumber]),
613
            sprintf('Cannot find order with number "%s" in the list.', $orderNumber)
614
        );
615
    }
616
617
    /**
618
     * @Then I should not see the order with number :orderNumber in the list
619
     */
620
    public function iShouldNotSeeASingleOrderFromCustomer($orderNumber)
621
    {
622
        Assert::false(
623
            $this->indexPage->isSingleResourceOnPage(['number' => $orderNumber]),
624
            sprintf('Cannot find order with number "%s" in the list.', $orderNumber)
625
        );
626
    }
627
628
    /**
629
     * @When I do not specify any information
630
     */
631
    public function iDoNotSpecifyAnyInformation()
632
    {
633
        // Intentionally left blank.
634
    }
635
636
    /**
637
     * @Then I should not be able to specify their password
638
     */
639
    public function iShouldNotBeAbleToSpecifyItPassword()
640
    {
641
        Assert::true(
642
            $this->createPage->isUserFormHidden(),
643
            'There should not be password field, but it is.'
644
         );
645
    }
646
647
    /**
648
     * @Then I should still be on the customer creation page
649
     */
650
    public function iShouldBeOnTheCustomerCreationPage()
651
    {
652
        Assert::true(
653
            $this->createPage->isOpen(),
654
            'The customer creation page should be open, but it is not.'
655
        );
656
    }
657
658
    /**
659
     * @Then I should be able to select create account option
660
     */
661
    public function iShouldBeAbleToSelectCreateAccountOption()
662
    {
663
        Assert::false(
664
            $this->createPage->hasCheckedCreateOption(),
665
            'The create account option should not be selected, but it is.'
666
        );
667
    }
668
669
    /**
670
     * @Then I should be able to specify their password
671
     */
672
    public function iShouldBeAbleToSpecifyItPassword()
673
    {
674
        Assert::true(
675
            $this->createPage->hasPasswordField(),
676
            'There should be password field, but it is not.'
677
        );
678
    }
679
680
    /**
681
     * @Then I should not be able to select create account option
682
     */
683
    public function iShouldNotBeAbleToSelectCreateAccountOption()
684
    {
685
        Assert::true(
686
            $this->createPage->hasCheckedCreateOption(),
687
            'The create account option should be selected, but it is not.'
688
        );
689
    }
690
691
    /**
692
     * @When I do not choose create account option
693
     */
694
    public function iDoNotChooseCreateAccountOption()
695
    {
696
        // Intentionally left blank.
697
    }
698
699
    /**
700
     * @Then I should not see create account option
701
     */
702
    public function iShouldNotSeeCreateAccountOption()
703
    {
704
        Assert::false(
705
            $this->createPage->hasCreateOption(),
0 ignored issues
show
Bug introduced by
The method hasCreateOption() does not exist on Sylius\Behat\Page\Admin\...mer\CreatePageInterface. Did you maybe mean create()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
706
            'The create account option should not be on customer creation page, but it is.'
707
        );
708
    }
709
710
    /**
711
     * @Then /^I should be notified that the password must be at least (\d+) characters long$/
712
     */
713
    public function iShouldBeNotifiedThatThePasswordMustBeAtLeastCharactersLong($amountOfCharacters)
714
    {
715
        Assert::same($this->createPage->getValidationMessage('password'), sprintf('Password must be at least %d characters long.', $amountOfCharacters));
716
    }
717
}
718