Skip to content

Commit

Permalink
Template: added __call() for BC [Closes #38]
Browse files Browse the repository at this point in the history
  • Loading branch information
fprochazka authored and dg committed Oct 26, 2014
1 parent 2c5302a commit f6e5a09
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/Bridges/ApplicationLatte/Template.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,15 @@ public function getParameters()
}


/**
* @deprecated
*/
public function __call($name, $args)
{
return $this->latte->invokeFilter($name, $args);
}


/**
* Sets a template parameter. Do not call directly.
* @return void
Expand Down
22 changes: 22 additions & 0 deletions tests/Application.Latte/Template.filters.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

/**
* Test: Template filters
*/

use Nette\Bridges\ApplicationLatte\Template,
Tester\Assert;


require __DIR__ . '/../bootstrap.php';

$engine = new Latte\Engine;
$template = new Template($engine);

Assert::exception(function () use ($template) {
$template->length('abc');
}, 'LogicException', "Filter 'length' is not defined.");

$engine->addFilter('length', 'strlen');

Assert::same( 3, $template->length('abc') );

0 comments on commit f6e5a09

Please sign in to comment.