Use the already present contexts

This commit is contained in:
Francis Hilaire 2023-05-02 20:50:46 +02:00 committed by Wojdylak
parent 38e2069524
commit e2fc25a1c1
6 changed files with 4 additions and 18 deletions

View file

@ -23,7 +23,7 @@ Feature: Resetting a password
And I specify customer email as "wrongman@example.com"
And I try to reset it
Then I should be notified that email with reset instruction has been sent
And no email should be sent
And 0 email should be sent to "wrongman@example.com"
@ui @email @api
Scenario: Resetting an account password in different locale than the default one
@ -59,7 +59,8 @@ Feature: Resetting a password
@ui @email @api
Scenario: Trying to change my account password with an expired token I received
Given I have already received a resetting password email a while ago
Given I have already received a resetting password email
But I waited too long, and the link expired
When I follow link on my email to reset my password
And I specify my new password as "newp@ssw0rd"
And I confirm my new password as "newp@ssw0rd"

View file

@ -18,7 +18,6 @@ use Sylius\Behat\Service\Checker\EmailCheckerInterface;
use Sylius\Behat\Service\SharedStorageInterface;
use Sylius\Component\Core\Model\OrderInterface;
use Sylius\Component\Core\Model\ShipmentInterface;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Contracts\Translation\TranslatorInterface;
use Webmozart\Assert\Assert;
@ -28,7 +27,6 @@ final class EmailContext implements Context
private SharedStorageInterface $sharedStorage,
private EmailCheckerInterface $emailChecker,
private TranslatorInterface $translator,
private Filesystem $filesystem,
) {
}

View file

@ -157,12 +157,10 @@ final class UserContext implements Context
}
/**
* @Given /^(?:(I) have|(this user) has) already received a resetting password email a while ago$/
* @Given /^(I) waited too long, and the link expired$/
*/
public function iWaitedTooMuchTimeToResetMyPassword(UserInterface $user): void
{
$this->prepareUserPasswordResetToken($user);
/** @var \DateTime $passwordRequestedAt */
$passwordRequestedAt = $user->getPasswordRequestedAt();
$passwordRequestedAt->sub(new \DateInterval($this->passwordResetTokenTtl));

View file

@ -28,7 +28,6 @@ final class EmailContext implements Context
private SharedStorageInterface $sharedStorage,
private EmailCheckerInterface $emailChecker,
private TranslatorInterface $translator,
private Filesystem $filesystem,
) {
}
@ -53,14 +52,6 @@ final class EmailContext implements Context
);
}
/**
* @Then no email should be sent
*/
public function noEmailShouldBeSent(): void
{
Assert::false($this->filesystem->exists($this->emailChecker->getSpoolDirectory()));
}
/**
* @Then an email with the :method shipment's confirmation for the :orderNumber order should be sent to :email
*/

View file

@ -18,7 +18,6 @@
<argument type="service" id="sylius.behat.shared_storage" />
<argument type="service" id="sylius.behat.email_checker" />
<argument type="service" id="translator" />
<argument type="service" id="filesystem" />
</service>
</services>
</container>

View file

@ -564,7 +564,6 @@
<argument type="service" id="sylius.behat.shared_storage" />
<argument type="service" id="sylius.behat.email_checker" />
<argument type="service" id="translator" />
<argument type="service" id="filesystem" />
</service>
<service