次のシナリオがあります。
@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
すべてのシナリオの前に、データベースが削除され、スキーマから再作成されます。
'given an activator with ...' のステップは、新しいユーザーをデータベースに挿入します。
でも!両方のユーザーに対して常にそうするとは限りません。
これはステップの実装です:
/**
* @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);
}
ここで奇妙なこと
に、最後のステップで、2 つのインサートを取得する必要があります。
次の場合に2つの挿入を取得します。
- シナリオを 1 つだけ実行する
- ログに何かを出力します (「ロガー」を作成しても役に立ちません。何かを出力する必要があります。出力するものは動的である必要はなく、固定文字列にすることができます)
次の場合、(dietervds 用に) 1 つの挿入のみを取得します。
- 2 つのシナリオを一緒に実行する
- または、ステップの実装でログを出力しない場合
私はこれに完全に困惑しています。
明らかに欠けているものはありますか?ステップ定義で何らかのキャッシングの問題が発生している可能性がありますか? (ロギングにより署名または何かが変更される可能性がありますが、わかりません)
フィードバックは大歓迎です:-)
乾杯!
ディーター