File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Coreplex \Notifier \Tests ;
4+
5+ class ParserTest extends BaseTest
6+ {
7+ public function testParseReturnsString ()
8+ {
9+ $ parser = $ this ->parser ();
10+ $ template = 'hello world ' ;
11+
12+ $ this ->assertInternalType ('string ' , $ parser ->parse ($ template ));
13+ }
14+
15+ public function testParserReplacesPlaceholders ()
16+ {
17+ $ parser = $ this ->parser ();
18+ $ template = '{{ foo }} [if:baz] {{ baz }} [endif] ' ;
19+ $ parsed = $ parser ->parse ($ template , [
20+ 'foo ' => 'bar ' ,
21+ 'baz ' => 'qux '
22+ ]);
23+
24+ $ this ->assertContains ('bar ' , $ parsed );
25+ $ this ->assertContains ('qux ' , $ parsed );
26+ }
27+
28+ public function testIfStatementsAreRemovedIfReplacementIsNotSet ()
29+ {
30+ $ parser = $ this ->parser ();
31+ $ template = '{{ foo }} [if:baz] {{ baz }} [endif] ' ;
32+ $ parsed = $ parser ->parse ($ template , [
33+ 'foo ' => 'bar ' ,
34+ ]);
35+
36+ $ this ->assertContains ('bar ' , $ parsed );
37+ $ this ->assertNotContains ('qux ' , $ parsed );
38+ }
39+ }
You can’t perform that action at this time.
0 commit comments