'; static public function provider() { return array( // pipe cond array( 'Link', 'cond > 10){ ?> class="active">Link' ), // cond array( 'Link1say, hello', 'Link1cond){ ?>say, hello' ), // cond array( 'Link1Link2', 'Link1v==$__Context->k){ ?>Link2' ), // for loop array( '', '' ), // foreach loop array( '', '' ), // while loop array( '', '' ), // ~ array( 'LinkHello, world', 'Linkcond){ ?>Hello, world' ), // ~ array( 'LinkHello, {$world}', 'Linkcond){ ?>Hello, world ?>' ), // ~ ~ array( 'LinkHello, worldWow', 'Linkcond){ ?>Hello, worldWow' ), // ~ ~ ~ array( 'LinkHello, worldHaHaWow', 'Linkcond){ ?>Hello, worldcond2){ ?>HaHaWow' ), // ~ array( '
  • Repeat this
  • ', 'i=0;$__Context->i<$__Context->len;$__Context->i++){ ?>
  • Repeat this
  • ' ), // ~ array( '
  • item{$key} : {$val}
  • ', 'arr&&count($__Context->arr))foreach($__Context->arr as $__Context->key=>$__Context->val){ ?>
  • itemkey ?> : val ?>
  • ' ), // ~ array( '{$v->text}', 'item=$__Context->list->getItem()){ ?>v->text ?>' ), // ~ ~ ~ ~ array( 'ABC', 'var){ ?>ABC' ), // invalid block statement array( '', '' ), // {@ ...PHP_CODE...} array( '{@$list_page = $page_no}', 'list_page = $__Context->page_no ?>' ), // %load_js_plugin array( '', '' ), // #include array( '
    This is another dummy
    ', 'compile(\'tests/classes/template\',\'sample.html\') ?>
    This is another dummy
    ' ), // array( '
    This is another dummy
    ', 'compile(\'tests/classes\',\'sample.html\') ?>
    This is another dummy
    ' ), // array( '', '' ), // array( '', '' ), // array( '', '' ), // array( '', 'compile(); ?>' ), // array( '', '' ), // array( '', '' ), // comment array( '', '' ), // self-closing tag array( '', 'foo){ ?>' ), // relative path1 array( '', '' ), // relative path2 array( '', '' ), // error case array( 'logo', 'layout_info->logo_image){ ?>logo' ), // error case - ignore stylesheets array( '', '' ), // error case - ignore json array( '', '' ), // error case - inline javascript array( '
    ', '
    ' ), // issue 103 array( '', '' ), // issue 135 array( '

    {$key}

    Loop block {$val}
    ', '_m_list_all&&count($__Context->_m_list_all))foreach($__Context->_m_list_all as $__Context->key=>$__Context->val){ ?>

    key ?>

    Loop block val ?>
    ' ), // issue 136 array( '
    bar', 'var==\'foo\'){ ?>
    bar' ), // issue 188 array( '
    Hello, world!
    ', 'ii < $__Context->nn){ ?>dummy&&count($__Context->dummy))foreach($__Context->dummy as $__Context->k=>$__Context->v){ ?>
    Hello, world!
    ' ), // issue 190 array( '
    Hello, world!
    ', 'i >= $__Context->n)){ ?>dummy&&count($__Context->dummy))foreach($__Context->dummy as $__Context->k=>$__Context->v){ ?>
    Hello, world!
    ' ), // issue 183 array( ''."\n".'
    {$vvv}
    CD
    ', 'vvvls&&count($__Context->vvvls))foreach($__Context->vvvls as $__Context->vvv){ ?>'."\n".'
    vvv ?>
    CD
    ' ), // issue 512 - ignores array( '
    {$lang->sl_show_topimgtext}
    ', '
    lang->sl_show_topimgtext ?>
    ' ), ); } /** * @dataProvider provider */ public function testParse($tpl, $expected) { $tmpl = TemplateHandler::getInstance(); $tmpl->init(dirname(__FILE__), 'sample.html'); $result = $tmpl->parse($tpl); $this->assertEquals($result, $this->prefix.$expected); } public function testParse2() { $tmpl = TemplateHandler::getInstance(); $tmpl->init(dirname(__FILE__), 'no_file.html'); $result = $tmpl->parse(); $this->assertEquals($result, ''); } public function testCompileDirect() { $tmpl = TemplateHandler::getInstance(); $result = $tmpl->compileDirect(dirname(__FILE__), 'sample.html'); $result = trim($result); $this->assertEquals($result, $this->prefix.'has_blog){ ?>Taggon\'s blog'); } }