Created
March 6, 2012 10:42
-
-
Save palmic/1985634 to your computer and use it in GitHub Desktop.
Acount login feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Feature: management login | |
As a account owner | |
I want to login to my account management | |
Background: | |
Given We are logged out | |
And We have no user | |
And I create new account | |
Scenario: management login | |
When I go to new account info edit #behat native step | |
Then User is not authenticated #behat native step | |
And Response status code is 401 #behat native step | |
And I should see "sf_guard signin" form | |
When I login as "created account owner" | |
Then User is authenticated #behat native step | |
And I should see "created account" "info" edit | |
When We are logged out | |
Then User is not authenticated #behat native step |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$steps->Given('/^We are logged out$/', function($world) use ($steps) { | |
$steps->When('I go to signout', $world) | |
->And('I was redirected', $world) | |
->Then('User is not authenticated', $world) | |
; | |
}); | |
$steps->Given('/^We have no user$/', function($world) use($steps) | |
{ | |
$steps->Given('We have no book saved', $world); | |
// delete all accounts... | |
}); | |
$steps->When('/^I create new account$/', function($world) use ($steps) | |
{ | |
$steps->When('I go to new account form', $world) | |
->And('I submit account', $world) | |
->And('I follow redirect', $world); | |
}); | |
// finds form by MVC action name trough form action URL | |
$steps->Then('/^I should see "([^"]*)" form$/', function($world, $kw) | |
{ | |
$action = sfContext::getInstance()->getRouting()->generate(str_replace(' ', '_', $kw)); | |
$world->browser->with('response')->checkElement('form[action="' . $action . '"]'); | |
}); | |
$steps->When('/^I login as "created account owner"$/', function($world) | |
{ | |
$world->browser->click('form input[type="submit"]', array('signin' => array( | |
'username' => $world->dataFormAccountCreate['User']['cs']['email'], | |
'password' => $world->dataFormAccountCreate['User']['password'], | |
)))->followRedirect(); | |
}); | |
// checks if current response is concrete section of concrete viewName | |
$steps->Then('/^I should see "([^"]*)" "([^"]*)" edit$/', function($world, $viewName, $section) | |
{ | |
$world->browser | |
->with('response')->checkElement('h1', $viewName) | |
->with('response')->checkElement('#menu-tabs li#menu-views-more-section-'.$section.' strong') | |
; | |
}); |
How do i create a website
But not log in problem comes account login github
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How do i create a website