Skip to content

Instantly share code, notes, and snippets.

@gabriel403
Last active August 29, 2015 14:05
Show Gist options
  • Save gabriel403/d5bcae27ddac24893d65 to your computer and use it in GitHub Desktop.
Save gabriel403/d5bcae27ddac24893d65 to your computer and use it in GitHub Desktop.
<?php
use Behat\Behat\Context\ClosuredContextInterface,
Behat\Behat\Context\TranslatedContextInterface,
Behat\Behat\Context\BehatContext,
Behat\Behat\Exception\PendingException;
use Behat\Gherkin\Node\PyStringNode,
Behat\Gherkin\Node\TableNode,
Behat\MinkExtension\Context\MinkContext,
Behat\Behat\Context\Step,
Behat\Behat\Event\StepEvent;
/**
* Features context.
*/
class FeatureContext extends MinkContext
{
/**
* @Given /^I am logged in as "([^"]*)" with password "([^"]*)"$/
*/
public function iAmLoggedInAsWithPassword($email, $password)
{
return array(
new Step\Given('I am on "/"'),
new Step\Given('I should see "Login"'),
new Step\When('I fill in "identity" with "'.$email.'"'),
new Step\When('I fill in "credential" with "'.$password.'"'),
new Step\When('I press "submitbtn"'),
);
}
}
<?php
use Behat\Behat\Context\SnippetAcceptingContext;
use Behat\Gherkin\Node\PyStringNode;
use Behat\Gherkin\Node\TableNode;
use Behat\Testwork\Tester\Result\TestResult;
use Behat\Behat\Definition\Call;
use Behat\MinkExtension\Context\MinkContext;
/**
* Behat context class.
*/
class FeatureContext extends MinkContext
{
/**
* @Given /^I am redirected to the login page$/
*/
public function iAmRedirectedToTheLoginPage()
{
return array(
new Call\Given('I am on "/"'),
new Call\Given('I should see "Login"'),
new Call\When('I follow "Login"'),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment