Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Symfony 在my Behat场景中传递一个强制参数_Symfony_Testing_Routing_Bdd_Behat - Fatal编程技术网

Symfony 在my Behat场景中传递一个强制参数

Symfony 在my Behat场景中传递一个强制参数,symfony,testing,routing,bdd,behat,Symfony,Testing,Routing,Bdd,Behat,我正在尝试确定如何通过一个必需的参数,该参数是在我的Behat features文件中按照定义的路线进行操作所必需的 这是我的设想: 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:

我正在尝试确定如何通过一个必需的参数,该参数是在我的Behat features文件中按照定义的路线进行操作所必需的

这是我的设想:

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
这就是错误:

鉴于我在ayrshireminis_cars_asset_create页面 某些必需参数缺少categoryId,无法为路线ayrshireminis\u cars\u asset\u create生成URL。 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