class EmailContext implements Context (View source)

Context used to define steps related to email sending.

Traits

Represents a behat context which is aware of a main {SilverStripeContext} context.

Properties

protected SilverStripeContext $mainContext from  MainContextAwareTrait
protected TestMailer $mailer
protected $lastMatchedEmail

Stored to simplify later assertions

Methods

public
getMainContext()

Get the main context

public
$this
setMainContext(SilverStripeContext $mainContext)

No description

public
detectMainContext(BeforeScenarioScope $scope)

Helper method to detect the main context

public
Session
getSession(string $name = null)

Get Mink session from MinkContext

public
before(BeforeScenarioScope $event)

No description

public
thereIsAnEmailFromTo(string $negate, string $direction, string $email)

No description

public
thereIsAnEmailFromToTitled(string $negate, string $direction, string $email, string $subject)

No description

public
thereTheEmailContains(string $negate, string $content)

Example: Given the email should contain "Thank you for registering!".

public
thereTheEmailContainsPlainText(string $content)

Example: Given the email contains "Thank you for registering!".

public
iGoToInTheEmailTo(string $linkSelector, string $direction, string $email)

No description

public
iGoToInTheEmailToTitled(string $linkSelector, string $direction, string $email, string $title)

No description

public
iGoToInTheEmail(string $linkSelector)

Assumes an email has been identified by a previous step, e.g. through 'Given there should be an email to "[email protected]"'.

public
iClearAllEmails()

No description

public
theEmailContainFollowingData(string $negate, TableNode $table)

Example: Then the email should contain the following data: | row1 | | row2 | Assumes an email has been identified by a previous step.

public
thereIsAnEmailTitled(string $negate, string $subject)

No description

public
theEmailSentFrom(string $negate, string $from)

No description

public
theEmailSentTo(string $negate, string $to)

No description

public
iClickOnHttpLinkInEmail(string $httpText)

The link text is the link address itself which contains special characters e.g. http://localhost/Security/changepassword?m=199&title=reset Example: When I click on the http link "changepassword" in the email

Details

SilverStripeContext getMainContext()

Get the main context

Return Value

SilverStripeContext

$this setMainContext(SilverStripeContext $mainContext)

No description

Parameters

SilverStripeContext $mainContext

Return Value

$this

detectMainContext(BeforeScenarioScope $scope)

Helper method to detect the main context

Parameters

BeforeScenarioScope $scope

Session getSession(string $name = null)

Get Mink session from MinkContext

Parameters

string $name

Return Value

Session

before(BeforeScenarioScope $event)

No description

Parameters

BeforeScenarioScope $event

thereIsAnEmailFromTo(string $negate, string $direction, string $email)

No description

Parameters

string $negate
string $direction
string $email

thereIsAnEmailFromToTitled(string $negate, string $direction, string $email, string $subject)

No description

Parameters

string $negate
string $direction
string $email
string $subject

thereTheEmailContains(string $negate, string $content)

Example: Given the email should contain "Thank you for registering!".

Assumes an email has been identified by a previous step, e.g. through 'Given there should be an email to "[email protected]"'.

Parameters

string $negate
string $content

thereTheEmailContainsPlainText(string $content)

Example: Given the email contains "Thank you for registering!".

Then the email should contain plain text "Thank you for registering!" Assumes an email has been identified by a previous step, e.g. through 'Given there should be an email to "[email protected]"'.

Parameters

string $content

iGoToInTheEmailTo(string $linkSelector, string $direction, string $email)

No description

Parameters

string $linkSelector
string $direction
string $email

iGoToInTheEmailToTitled(string $linkSelector, string $direction, string $email, string $title)

No description

Parameters

string $linkSelector
string $direction
string $email
string $title

iGoToInTheEmail(string $linkSelector)

Assumes an email has been identified by a previous step, e.g. through 'Given there should be an email to "[email protected]"'.

Parameters

string $linkSelector

iClearAllEmails()

No description

theEmailContainFollowingData(string $negate, TableNode $table)

Example: Then the email should contain the following data: | row1 | | row2 | Assumes an email has been identified by a previous step.

Parameters

string $negate
TableNode $table

thereIsAnEmailTitled(string $negate, string $subject)

No description

Parameters

string $negate
string $subject

theEmailSentFrom(string $negate, string $from)

No description

Parameters

string $negate
string $from

theEmailSentTo(string $negate, string $to)

No description

Parameters

string $negate
string $to

iClickOnHttpLinkInEmail(string $httpText)

The link text is the link address itself which contains special characters e.g. http://localhost/Security/changepassword?m=199&title=reset Example: When I click on the http link "changepassword" in the email

Parameters

string $httpText