CodeCeption - 将选项传递给助手

时间:2016-03-30 07:46:37

标签: php testing codeception

是否可以将config参数传递给扩展\Codeception\Module类的helper类。 我有以下情况,我想在模块启用部分的api.suite.yml配置文件中设置例如Helper\Api并设置其cofig属性。

我的想法是拥有不同配置属性的不同环境。 这可能吗?

class_name: ApiTester
modules:
    enabled:
      - \Helper\Api:      # This is my module
        my_path: C://ssss # This is my custom option I want to pass.

我的模块课程。

class Api extends \Codeception\Module
{
    protected $requiredFields = ['my_path'];
    ...
}

当我运行套件时,它失败了:

  [Codeception\Exception\ModuleConfigException]
  Helper\Api module is not configured!

  Options: my_path are required
  Please, update the configuration and set all the required fields

1 个答案:

答案 0 :(得分:1)

你必须更多地缩进参数: class_name: ApiTester modules: enabled: - \Helper\Api: # This is my module my_path: C://ssss # This is my custom option I want to pass.

相关问题