gpt4 book ai didi

symfony - 在我的 Behat 场景中传递强制参数

转载 作者:行者123 更新时间:2023-11-28 20:54:39 25 4
gpt4 key购买 nike

我正在尝试确定如何传递遵循我的 Behat 功能文件中定义的路线所需的强制参数。

这是我的场景:

Scenario: I should be able to create a cars asset
Given I am on the ayrshireminis_cars_asset_create page
When I submit a "ayrshireminis.cars.asset.type" form with values:
| name | type | position | active |
| Cars Info Doc | PDF | 1 | 1 |
Then The form should be valid

这是错误:

Given I am on the ayrshireminis_cars_asset_create page Some mandatory parameters are missing ("categoryId") to generate a URL for route "ayrshireminis_cars_asset_create". (Symfony\Component\Routing\Exception\MissingMandatoryParametersException)

很明显为什么我会收到此错误,因为我的路由配置如下:

ayrshireminis_cars_asset_create:
pattern: /category/{categoryId}/asset/new/

如何传递 categoryId

最佳答案

我发现我是从错误的角度来看这个的,最后我是这样构建测试场景的:

Scenario: Submitting a valid cars asset form
When I submit a "ayrshireminis.cars.cars_asset.type" form with values:
| name | type | position | active |
| Cars Info Doc | pdf | 1 | 1 |
Then the form should be valid
And the cars entity form entity should have the following values
| name | type | position | active |
| Cars Info Doc | pdf | 1 | 1 |
And the cars entity form entity should be persisted correctly

关于symfony - 在我的 Behat 场景中传递强制参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29778649/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com