Skip to content

Commit

Permalink
Added test to ensure view parser plugins works when defined as closure.
Browse files Browse the repository at this point in the history
  • Loading branch information
lonnieezell committed May 15, 2019
1 parent 2133346 commit 6713500
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/system/View/ParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -747,6 +747,25 @@ public function testParserPluginNoParams()

//--------------------------------------------------------------------

/**
* @group parserplugins
*/
public function testParserPluginClosure()
{
$config = $this->config;
$config->plugins['hello'] = function (array $params = []) {
return 'Hello, ' . trim($params[0]);
};

$parser = new Parser($config, $this->viewsDir, $this->loader);

$template = '{+ hello world +}';

$this->assertEquals('Hello, world', $parser->renderString($template));
}

//--------------------------------------------------------------------

/**
* @group parserplugins
*/
Expand Down

0 comments on commit 6713500

Please sign in to comment.