public function testProcessorDeclare()
{
$handlers = new HandlerContainer();
$handlers->add('declare', function (ProcessedShortcode $s) use($handlers) {
$handlers->add($s->getParameterAt(0), function (ShortcodeInterface $x) use($s) {
$keys = array_map(function ($item) {
return '%' . $item . '%';
}, array_keys($x->getParameters()));
$values = array_values($x->getParameters());
return str_replace($keys, $values, $s->getContent());
});
});
$processor = new Processor(new RegexParser(), $handlers);
$this->assertSame('You are 18 years old.', trim($processor->process('
[declare age]You are %age% years old.[/declare]
[age age=18]
')));
}