Last active
August 29, 2015 14:09
-
-
Save nedSaf/c4669b809d9f6be913f6 to your computer and use it in GitHub Desktop.
Behat login
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
<?php | |
/** | |
* Initializes context. | |
* | |
* Every scenario gets its own context object. | |
* | |
* @param array $parameters. | |
* Context parameters (set them up through behat.yml or behat.local.yml). | |
*/ | |
public function __construct(array $parameters) { | |
if (!empty($parameters['drupal_users'])) { | |
$this->drupal_users = $parameters['drupal_users']; | |
} | |
} | |
/** | |
* Authenticates a user with password from configuration. | |
* | |
* @Given /^I am logged in as user "([^"]*)"$/ | |
*/ | |
public function iAmLoggedInAsUser($username) { | |
$this->user = new stdClass(); | |
$this->user->name = $username; | |
$this->user->pass = $this->drupal_users[$username]; | |
$this->login(); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment