|
|
@@ -90,7 +90,8 @@ class StringTemplateTest extends TestCase
|
|
|
{
|
|
|
$templates = [
|
|
|
'link' => '<a href="{{url}}">{{text}}</a>',
|
|
|
- 'text' => '{{text}}'
|
|
|
+ 'text' => '{{text}}',
|
|
|
+ 'custom' => '<custom {{standard}} v1="{{var1}}" v2="{{var2}}" />'
|
|
|
];
|
|
|
$this->template->add($templates);
|
|
|
|
|
|
@@ -108,6 +109,12 @@ class StringTemplateTest extends TestCase
|
|
|
'text' => 'example'
|
|
|
]);
|
|
|
$this->assertEquals('<a href="/">example</a>', $result);
|
|
|
+
|
|
|
+ $result = $this->template->format('custom', [
|
|
|
+ 'standard' => 'default',
|
|
|
+ 'templateParams' => ['var1' => 'foo']
|
|
|
+ ]);
|
|
|
+ $this->assertEquals('<custom default v1="foo" v2="" />', $result);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -196,6 +203,13 @@ class StringTemplateTest extends TestCase
|
|
|
' data-hero="<batman>"',
|
|
|
$result
|
|
|
);
|
|
|
+
|
|
|
+ $attrs = ['name' => 'bruce', 'data-hero' => '<batman>', 'templateParams' => ['foo' => 'bar']];
|
|
|
+ $result = $this->template->formatAttributes($attrs, ['name']);
|
|
|
+ $this->assertEquals(
|
|
|
+ ' data-hero="<batman>"',
|
|
|
+ $result
|
|
|
+ );
|
|
|
}
|
|
|
|
|
|
/**
|