我正在使用Symfony2与Behat,Mink和FosUser Bundle。问题是登录测试总是失败(登录在开发中完美地运行)。
Scenario: A user can login
Given I am on "http://localhost:8888/myapp/web/login"
And fill in "username" with "psitest@domain.pt"
And fill in "password" with "pass"
And press "login"
Then I should see "Logout"
测试失败,在当前页面的文本中找不到“Logout”文本。 有什么遗漏或我如何调试问题的任何想法?
我可以使用Behat / Mink测试未经过身份验证的页面。
[更新]
config_test如下(只是相关位):
## Security Configuration
security:
encoders:
Symfony\Component\Security\Core\User\User: plaintext
providers:
main:
users:
psitest@thisislove.pt: { password: senha, roles: ROLE_ADMIN }
firewalls:
secured_area:
pattern: ^/
http_basic: true
logout: true
security: true
anonymous: true
答案 0 :(得分:2)
“打印最后回复”步骤应该可以帮助您找出问题所在:
Scenario: A user can login
Given I am on "http://localhost:8888/myapp/web/login"
And fill in "username" with "psitest@domain.pt"
And fill in "password" with "pass"
And press "login"
And print last response
Then I should see "Logout"
答案 1 :(得分:0)
它不起作用可能是因为用户的密码不是传递,而是 senha 。