设置程序中的html,如何在Behat中为HTML格式化程序设置自定义模板
您可以從現(xiàn)有HtmlFormatter擴展自定義類,以明確設(shè)置您的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
如果要直接指定此格式化程序,請執(zhí)行以下操作:
behat --format Behat\\Behat\\Formatter\\MyHtmlFormatter --out o.html
請注意,您需要\\才能正確發(fā)送課程名稱。
總結(jié)
以上是生活随笔為你收集整理的设置程序中的html,如何在Behat中为HTML格式化程序设置自定义模板的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: html可以有多个main吗,main和
- 下一篇: 北卡教堂山计算机科学专业,UNC的CS「