我将Symfony2与Behat,Mink和FosUser Bundle结合使用。问题是登录测试总是失败(登录在开发中完美工作)。无法在symfony2中测试用户身份验证
Scenario: A user can login
Given I am on "http://localhost:8888/myapp/web/login"
And fill in "username" with "[email protected]"
And fill in "password" with "pass"
And press "login"
Then I should see "Logout"
测试失败,在当前页面的文本中找不到文本“注销”。 关于缺少什么或如何调试问题的想法?
我可以用Behat/Mink测试未认证的页面。
[更新]
的config_test如下(只是相关位):
## Security Configuration
security:
encoders:
Symfony\Component\Security\Core\User\User: plaintext
providers:
main:
users:
[email protected]: { password: senha, roles: ROLE_ADMIN }
firewalls:
secured_area:
pattern: ^/
http_basic: true
logout: true
security: true
anonymous: true
与其他测试框架,独立zombie.js和Story.php还试图和他们都失败,所以也许它的东西与一些cookie或令牌丢失,导致测试失败,如果没有在浏览器中运行? – Sofia 2011-12-30 03:44:41
添加貂配置(从/app/config/config_test.yml)请 – Inoryy 2011-12-30 10:41:30