use Twig\Node\Node;
abstract class NodeTestCase extends TestCase
{ abstract public function getTests();
/**
* @dataProvider getTests
*/
public function testCompile($node,
$source,
$environment = null,
$isPattern = false
) { $this->
assertNodeCompilation($source,
$node,
$environment,
$isPattern);
} public function assertNodeCompilation($source, Node
$node, Environment
$environment = null,
$isPattern = false
) { $compiler =
$this->
getCompiler($environment);
$compiler->
compile($node);
if ($isPattern) { $this->
assertStringMatchesFormat($source,
trim($compiler->
getSource()));
} else { $this->
assertEquals($source,
trim($compiler->
getSource()));
}