Smoke testing of TWIG templates
OTHER License
...when you need to cover your Twig with smoke.
composer require tomasvotruba/torch --dev
torch.php
in your project root:use Twig\Environment;
require_once __DIR__ . '/vendor/autoload.php';
// create instance of Environment with everything needed for smoke render
$environment = new Environment(...);
return $environment;
In this file, you can override existing twig functions:
// override twig functions you need
StaticParameterProvider::set('overrideFunctions', [
// provide static value for dynamic function
'baseTemplate' => function () {
return DummyTheme::LAYOUT_NAME;
},
]);
vendor/bin/torch run templates
Happy coding!