Update behat scenarios

This commit is contained in:
winzou 2013-05-27 14:35:16 +02:00
parent b81a1c1bd5
commit 5bd55bc1fb
2 changed files with 10 additions and 11 deletions

View file

@ -5,15 +5,15 @@ Feature: Sign in to the store
Background:
Given there are following users:
| username | password | enabled |
| bar | foo | yes |
| email | password | enabled |
| bar@foo.com | foo | yes |
Scenario: Log in with username and password
Given I am on the store homepage
And I follow "Login"
When I fill in the following:
| Login | bar |
| Password | foo |
| Email | bar@foo.com |
| Password | foo |
And I press "Login"
Then I should be on the store homepage
And I should see "Logout"
@ -22,8 +22,8 @@ Feature: Sign in to the store
Given I am on the store homepage
And I follow "Login"
When I fill in the following:
| Login | bar |
| Password | bar |
| Email | bar@foo.com |
| Password | bar |
And I press "Login"
Then I should be on login page
And I should see "Bad credentials"
@ -32,7 +32,7 @@ Feature: Sign in to the store
Given I am on the store homepage
And I follow "Login"
When I fill in the following:
| Login | john |
| Email | john |
| Password | bar |
And I press "Login"
Then I should be on login page

View file

@ -133,7 +133,7 @@ class DataContext extends BehatContext implements KernelAwareInterface
foreach ($table->getHash() as $data) {
$this->thereIsUser(
$data['username'],
$data['email'],
isset($data['password']) ? $data['password'] : $this->faker->word(),
'ROLE_USER',
isset($data['enabled']) ? $data['enabled'] : true
@ -141,11 +141,10 @@ class DataContext extends BehatContext implements KernelAwareInterface
}
}
public function thereIsUser($username, $password, $role = null, $enabled = 'yes')
public function thereIsUser($email, $password, $role = null, $enabled = 'yes')
{
$user = new User();
$user->setUsername($username);
$user->setEmail($this->faker->email());
$user->setEmail($email);
$user->setEnabled('yes' === $enabled);
$user->setPlainPassword($password);