mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-14 17:10:53 +00:00
[Behat][Account] Implement scenarios for registering when channel has disabled registration confirmation
This commit is contained in:
parent
05dbcccc7a
commit
251800303f
4 changed files with 49 additions and 14 deletions
|
|
@ -19,7 +19,7 @@ Feature: Account registration
|
|||
Then I should be notified that new account has been successfully created
|
||||
But I should not be logged in
|
||||
|
||||
@ui @todo
|
||||
@ui
|
||||
Scenario: Registering a new account with minimum information when channel has disabled registration verification
|
||||
Given on this channel registration verification is disabled
|
||||
When I want to register a new account
|
||||
|
|
@ -64,13 +64,13 @@ Feature: Account registration
|
|||
Then I should be notified that new account has been successfully created
|
||||
And a welcoming email should have been sent to "ghastly@bespoke.com"
|
||||
|
||||
@ui @email @todo
|
||||
@ui @email
|
||||
Scenario: Receiving a verification email after registration
|
||||
When I register with email "ghastly@bespoke.com" and password "suitsarelife"
|
||||
Then I should be notified that new account has been successfully created
|
||||
And a verification email should have been sent to "ghastly@bespoke.com"
|
||||
|
||||
@ui @email @todo
|
||||
@ui @email
|
||||
Scenario: Not receiving a verification email after registration when channel has disabled registration verification
|
||||
Given on this channel registration verification is disabled
|
||||
When I register with email "ghastly@bespoke.com" and password "suitsarelife"
|
||||
|
|
|
|||
|
|
@ -163,6 +163,26 @@ final class ChannelContext implements Context
|
|||
$this->channelManager->flush();
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given /^on (this channel) shipping step is skipped if only a single shipping method is available$/
|
||||
*/
|
||||
public function onThisChannelShippingStepIsSkippedIfOnlyASingleShippingMethodIsAvailable(ChannelInterface $channel)
|
||||
{
|
||||
$channel->setSkippingShippingStepAllowed(true);
|
||||
|
||||
$this->channelManager->flush();
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given /^on (this channel) registration verification is disabled$/
|
||||
*/
|
||||
public function onThisChannelRegistrationVerificationIsDisabled(ChannelInterface $channel)
|
||||
{
|
||||
$channel->setDisabledRegistrationVerification(true);
|
||||
|
||||
$this->channelManager->flush();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ChannelInterface $channel
|
||||
* @param bool $state
|
||||
|
|
@ -173,14 +193,4 @@ final class ChannelContext implements Context
|
|||
$this->channelManager->flush();
|
||||
$this->sharedStorage->set('channel', $channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given /^on (this channel) shipping step is skipped if only a single shipping method is available$/
|
||||
*/
|
||||
public function onThisChannelShippingStepIsSkippedIfOnlyASingleShippingMethodIsAvailable(ChannelInterface $channel)
|
||||
{
|
||||
$channel->setSkippingShippingStepAllowed(true);
|
||||
|
||||
$this->channelManager->flush();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,6 +69,22 @@ final class EmailContext implements Context
|
|||
$this->assertEmailContainsMessageTo('Welcome to our store', $recipient);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then a verification email should have been sent to :recipient
|
||||
*/
|
||||
public function aVerificationEmailShouldHaveBeenSentTo($recipient)
|
||||
{
|
||||
$this->assertEmailContainsMessageTo('To verify your email address', $recipient);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then a verification email should not have been sent to :recipient
|
||||
*/
|
||||
public function aVerificationEmailShouldNotHaveBeenSentTo($recipient)
|
||||
{
|
||||
$this->assertEmailNotContainsMessageTo('To verify your email address', $recipient);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^an email with the summary of (order placed by "([^"]+)") should be sent to him$/
|
||||
*/
|
||||
|
|
@ -104,6 +120,15 @@ final class EmailContext implements Context
|
|||
Assert::true($this->emailChecker->hasMessageTo($message, $recipient));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $message
|
||||
* @param string $recipient
|
||||
*/
|
||||
private function assertEmailNotContainsMessageTo($message, $recipient)
|
||||
{
|
||||
Assert::false($this->emailChecker->hasMessageTo($message, $recipient));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param OrderInterface $order
|
||||
*
|
||||
|
|
|
|||
|
|
@ -220,7 +220,7 @@ class RegistrationContext implements Context
|
|||
public function iShouldBeNotifiedThatNewAccountHasBeenSuccessfullyCreated()
|
||||
{
|
||||
$this->notificationChecker->checkNotification(
|
||||
'Thank you for registering, check your email to verify your account.',
|
||||
'Thank you for registering. If you are not logged in, check your email to verify your account.',
|
||||
NotificationType::success()
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue