我遇到Behat和Mink的問題。在運行時,系統會提示將#2添加到我的函數聲明中。Behat無法識別已定義的步驟
這裏是版本信息我作曲文件
{
"require": {
"behat/behat": "2.5.*@stable",
"behat/mink": "~1.6",
"behat/mink-extension": "~1.0",
"behat/mink-goutte-driver": "~1.1",
"fabpot/goutte": "~1.0.4",
"behat/mink-selenium2-driver": "*"
},
"config": {
"bin-dir": "bin/"
}
}
這是我的步驟定義
Given the user "XXX" has logged in using the password "YYYYY"
我在FeatureContext.php
/**
* @Given /^the user "([^"]*)" has logged in using the password "([^"])"$/
*/
public function theUserHasLoggedInUsingThePassword($arg1, $arg2)
{
...
}
當我創建了一個處理程序運行Behat我收到消息
可以實現對不確定的步驟一步定義這些片段:
/**
* @Given /^the user "([^"]*)" has logged in using the password "([^"])"$/
*/
public function theUserHasLoggedInUsingThePassword2($arg1, $arg2)
{
$this->theUserHasLoggedInUsingThePassword($arg1,$arg2);
}
請注意,#2被添加到片段。
然後,當我在FeatureContext.php添加此片斷
/**
* @Given /^the user "([^"]*)" has logged in using the password "([^"])"$/
*/
public function theUserHasLoggedInUsingThePassword2($arg1, $arg2)
{
throw new PendingException();
}
具有兩個theUserHasLoggedInUsingThePassword和theUserHasLoggedInUsingThePassword2功能我收到
[貝哈特\貝哈特\異常\ RedundantException]
步驟「/ ^我已經用用戶登錄」([^「] *)」和密碼 「([^」])「$ /」已經在 FeatureContext :: iHaveLoggedInWithTheUserAndThePassword2()
FeatureContext :: iHaveLoggedInWithTheUserAndThePassword2()
FeatureContext :: iHaveLoggedInWithTheUserAndThePassword()
我覺得我遇到RedundantException是一個紅色的鯡魚,真正的問題是事實上,我需要添加一個2添加到它的功能。
任何人都能看到我錯過的任何東西?
你只加了'2'到在FeatureContext.php? –
中添加了兩個函數我將更新問題 – muglio
接受的答案表明這是通過修復打字錯誤來解決的 –