3
私はbehat.ymlで試してみましたが、私の/ supportディレクトリにテンプレートを入れましたが、助けはありません。BehatでHTMLフォーマッタのカスタムテンプレートを設定する方法
default:
formatter:
name: html
parameters:
template_path: html.tpl
私はbehat.ymlで試してみましたが、私の/ supportディレクトリにテンプレートを入れましたが、助けはありません。BehatでHTMLフォーマッタのカスタムテンプレートを設定する方法
default:
formatter:
name: html
parameters:
template_path: html.tpl
既存のHtmlFormatter
からカスタムクラスを拡張して、htmlテンプレートを明示的に設定することができます。
namespace Behat\Behat\Formatter;
use Behat\Behat\Formatter\HtmlFormatter;
class MyHtmlFormatter extends HtmlFormatter {
/**
* The HTML template to use for formatting.
* @return string
*/
protected function getHtmlTemplate()
{
return '
<div id="behat">
{{content}}
</div>
';
}
// You can override any other methods of HtmlFormatter that you want
// to define custom behavior.
}
PHPは、次にカスタムクラスを指すようにbehat.yml
ファイルを更新します。 behat.yml
(オプション - 。あなたはbehatコマンドラインで--format
を使用しない場合にのみ必要)
default:
formatter:
name: Behat\Behat\Formatter\MyHtmlFormatter
Behat最後に、次のコマンドでbehat
を実行します:
behat --out out.html your_feature.feature
これを指定する場合直接フォーマッタは、その後の操作を行います。あなたが適切にクラス名を送信するために\\
が必要
behat --format Behat\\Behat\\Formatter\\MyHtmlFormatter --out o.html
注意を。
ヒントをお寄せいただきありがとうございます。しかし、動作していないようです...私は、カスタムフォーマッタの新しいPHPファイルを作成し、ブートストラップにファイルを追加し、behat.ymlを更新しましたが、カスタムフォーマッタが呼び出されることはありません。それはあなたのために働くのですか? – lp1051
あなたは 'behat'を実行するためにどのようなコマンドを使用していますか? –
私が使用しているコマンドは 'behat --format html --out test.feature.html --config behat.yml test.feature' 私は何もエラーはありませんが、htmlテンプレートは常に'HtmlFormatter'。 – lp1051