如何在 Behat 中生成 url
我已经开始使用 BehatBundle 和 MinkBundle 测试我的 Symfony2 应用程序。现在我正在尝试编写检查某些页面响应的场景。这些页面可通过包含实体 ID 的 URL 访问。现在我想知道如何知道 Doctrine 插入了哪个 ID。
这是一个例子:
Background:
Given There is no "Category" in database
And I have a category "Todo Lists"
Scenario: The category can be viewed
Given I am on "/category/<id here>"
Then I should see "Todo Lists"
问题是我不知道如何找出插入的类别的ID。 Behat / Mink 可能做到这一点吗?
I have started to test my Symfony2 application with the BehatBundle and MinkBundle. Now I am trying to write scenarios that check the response of some pages. These pages are accessible via an URL which contain the ID of the entities. Now I'm wondering how to know which ID was inserted by Doctrine.
Here's an example:
Background:
Given There is no "Category" in database
And I have a category "Todo Lists"
Scenario: The category can be viewed
Given I am on "/category/<id here>"
Then I should see "Todo Lists"
The problem is I don't know how to find out the ID of the category inserted. Is that possible with Behat / Mink?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

发布评论
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
将自定义步骤添加到上下文类中,如下所示:
Add a custom step into your context class, something like this: