public function testVoltUsersFunctions() { $volt = new \Phalcon\Mvc\View\Engine\Volt\Compiler(); //Single string function $volt->addFunction('random', 'mt_rand'); //Function with closure $volt->addFunction('shuffle', function ($arguments, $exprArguments) { return 'str_shuffle(' . $arguments . ')'; }); $compilation = $volt->compileString('{{ random() }}'); $this->assertEquals($compilation, '<?php echo mt_rand(); ?>'); $compilation = $volt->compileString('{{ shuffle("hello") }}'); $this->assertEquals($compilation, '<?php echo str_shuffle(\'hello\'); ?>'); }