我有一个带特定标签的behat功能,我有两个beforeFeature功能。其中一个针对每个方案运行,其中一个仅针对特定标记方案运行。问题是没有标记的beforeFeature也会在具有标记的那些功能之前运行。我想使这个beforeFeature不能在具有特定标签的那些功能上运行。 例如,我有以下功能:
@taggedFeature
Feature: This feature runs tagged beforeFeature
在我的FeatureContect中,我有以下beforeFeature函数
/** @BeforeFeature */
public static function beforeFeatureDefault()
{
// Do something
}
和
/** @BeforeFeature @taggedFeature*/
public static function beforeFeatureTagged()
{
// Do something
}
我想要的是在我的标记功能之前不运行beforeFeatureDefault()函数。
答案 0 :(得分:1)
您可以使用~
排除标记的功能:
/** @BeforeFeature ~@taggedFeature */
public static function beforeFeatureDefault() {
echo 'beforeFeatureDefault()';
}
/** @BeforeFeature @taggedFeature */
public static function beforeFeatureTagged() {
echo 'beforeFeatureTagged()';
}