【发布时间】:2014-03-19 05:35:10
【问题描述】:
我正在尝试使用 Behat/Mink 测试“记住我”功能。这是我的场景:
Scenario: A user logs in ticking "Remember me". As he closes his browser and visits back the site, he should be automatically logged in
Given I am on "/login"
Then I should see "Site Login"
When I fill in "Username" with "test"
And I fill in "Password" with "test"
And I check "Remember me"
When I press "Login"
Then I should see "Welcome"
When I restart the browser
Then I go to "/login"
Then I should see "Welcome"
重启浏览器的定义如下:
/**
* @When /^I restart the browser$/
*/
public function iRestartTheBrowser()
{
$this->getSession()->restart();
}
我也试过$this->getSession()->reset();
问题是由于浏览器重启后cookies被删除,“记住我”功能不再起作用。有什么方法可以在不清除 cookie 的情况下在 mink 中重新启动?
【问题讨论】:
标签: session-cookies behat remember-me mink