fenom->compileCode('{$text|truncate:$count:$delim:$by_words:$middle}'); $this->assertEquals($out, $tpl->fetch(array( "text" => $in, "count" => $count, "delim" => $delim, "by_words" => $by_words, "middle" => $middle ))); } public static function providerUpLow() { return array( array("up", "lorem", "LOREM"), array("up", "Lorem", "LOREM"), array("up", "loREM", "LOREM"), array("up", "223a", "223A"), array("low", "lorem", "lorem"), array("low", "Lorem", "lorem"), array("low", "loREM", "lorem"), array("low", "223A", "223a"), ); } /** * @dataProvider providerUpLow * @param $modifier * @param $in * @param $out */ public function testUpLow($modifier, $in, $out) { $tpl = $this->fenom->compileCode('{$text|' . $modifier . '}'); $this->assertEquals($out, $tpl->fetch(array( "text" => $in, ))); } public static function providerLength() { return array( array("length", 6), array("длина", 5), array("length - длина", 14), array(array(1, 33, "c" => 4), 3), array(new \ArrayIterator(array(1, "c" => 4)), 2), array(true, 0), array(new \stdClass(), 0), array(5, 0) ); } /** * @dataProvider providerLength * @param $in * @param $in * @param $out */ public function testLength($in, $out) { $tpl = $this->fenom->compileCode('{$data|length}'); $this->assertEquals($out, $tpl->fetch(array( "data" => $in, ))); } }