I have the following scenario's:
@wip
Scenario: Attempt to get account information of an activator without credentials
Given an activator with e-mail "dietervds@email.com" and password "testpassword" already exists
When I send a GET request to "/activators/1"
Then the response code should be 401
@wip
Scenario: Attempt to get account information of another activator then myself
Given an activator with e-mail "dietervds@email.com" and password "testpassword" already exists
And an activator with e-mail "eviltwin@email.com" and password "testpassword" already exists
And I am authenticating as "eviltwin@email.com" with "testpassword" password
When I send a GET request to "/activators/1"
Then the response code should be 401
The database is dropped and re-created from schema before every scenario.
The step 'given an activator with ...' inserts a new user into the database.
However! It doesn't always do that for both users.
This is the step implementation:
/**
* @Given /^an activator with e-mail "([^"]*)" and password "([^"]*)" already exists$/
*/
public function anActivatorWithEMailAndPasswordAlreadyExists($email, $password)
{
$activatorManager = $this->getContainer()->get('am.manager.activator');
#$logger = $this->getContainer()->get('logger');
#$logger->debug("Email: $email, password: $password");
$activator = $activatorManager->createActivator($email, $password);
$activatorManager->save($activator);
}
Now the weird thing:
In that last step, I should be getting two inserts: one for dietervds, one of eviltwin.
I get the two inserts when I:
- Run only one scenario
- Output something in logging (creating the 'logger' doesn't help, I need to output something. What I output doesn't have to be dynamic, it can just be a fixed string)
I only get one insert (for dietervds) when I:
- Run the two scenarios together
- Or when I don't output any logging in the step implementation
I am completely baffled by this.
Is there something obvious that's missing? Might it be some sort of caching problem in the step definitions? (the logging might change the signature or something, not sure)
Any feedback is welcome :-)
Cheers!
Dieter