【发布时间】:2016-09-20 03:00:28
【问题描述】:
我在FeatureContext中实现了这个功能,但是不知道behat.yml中怎么配置
这是我的代码
FeatureContext.php
/**
* @Then /^the file ".+" should be downloaded$/
* @param $filename
*
* @throws \Exception
*/
public function assertFileDownloaded($filename) {
if (!file_exists('/download/dir/' . $filename)) {
throw new Exception("Can not download");
}
}
下载.feature
Scenario: Download unlock documents with Success Stories
When I am on "managed-security-services/downloads/"
Then I should be on "/managed-security-services/downloads/"
And I should see "Bühler"
Then I click on the text "Bühler"
And I wait for "1" seconds
And the file ".+" should be downloaded
我不知道如何将参数传递给 behat.yml 这是代码
suites:
default:
paths: &featurePaths
- '%paths.base%/features'
contexts: &contexts
- FeatureContext
当我运行测试时,它显示如下消息错误:
[Behat\Testwork\Argument\Exception\UnknownParameterValueException] 找不到方法
$filename的参数FeatureContext::assertFileDownloaded()的匹配值。
【问题讨论】: