设置程序中的html,如何在Behat中为HTML格式化程序设置自定义模板
您可以從現有HtmlFormatter擴展自定義類,以明確設置您的html模板。
PHP 強>
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 '
{{content}}
';
}
// You can override any other methods of HtmlFormatter that you want
// to define custom behavior.
}
然后更新您的behat.yml文件以指向您的自定義類。
behat.yml(可選 - 僅在您的behat命令行中不使用--format時才需要。)
default:
formatter:
name: Behat\Behat\Formatter\MyHtmlFormatter
貝哈特強>
最后,使用以下命令運行behat:
behat --out out.html your_feature.feature
如果要直接指定此格式化程序,請執行以下操作:
behat --format Behat\\Behat\\Formatter\\MyHtmlFormatter --out o.html
請注意,您需要\\才能正確發送課程名稱。
總結
以上是生活随笔為你收集整理的设置程序中的html,如何在Behat中为HTML格式化程序设置自定义模板的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: html可以有多个main吗,main和
- 下一篇: html写登录框中的字,一个登录界面的P