Пример #1
0
 function testChain()
 {
     $tpl = $this->newPHPTAL('input/tal-content.06.html');
     $res = normalize_html($tpl->execute());
     $exp = normalize_html_file('output/tal-content.06.html');
     $this->assertEquals($exp, $res);
 }
 function testIt()
 {
     $tpl = $this->newPHPTAL('input/talesphpwithreplace.01.html');
     $res = normalize_html($tpl->execute());
     $exp = normalize_html_file('output/talesphpwithreplace.01.html');
     $this->assertEquals($exp, $res);
 }
Пример #3
0
 function testDoesEscapeHTMLContent()
 {
     $tpl = $this->newPHPTAL('input/escape.html');
     $exp = normalize_html_file('output/escape.html');
     $res = normalize_html($tpl->execute());
     $this->assertEquals($exp, $res);
 }
Пример #4
0
 function testWithCondition()
 {
     $tpl = $this->newPHPTAL('input/tal-omit-tag.02.html');
     $res = normalize_html($tpl->execute());
     $exp = normalize_html_file('output/tal-omit-tag.02.html');
     $this->assertEquals($exp, $res);
 }
Пример #5
0
 function testInheritedMacroSlots()
 {
     $tpl = $this->newPHPTAL('input/metal-macro.07.html');
     $res = normalize_html($tpl->execute());
     $exp = normalize_html_file('output/metal-macro.07.html');
     $this->assertEquals($exp, $res);
 }
Пример #6
0
 function testMultilineInTemplate()
 {
     $tpl = $this->newPHPTAL('input/tal-comment.02.html');
     $res = normalize_html($tpl->execute());
     $exp = normalize_html_file('output/tal-comment.02.html');
     $this->assertEquals($exp, $res);
 }
Пример #7
0
 function testEscape()
 {
     $tpl = $this->newPHPTAL('input/tales-string-03.html');
     $res = $tpl->execute();
     $res = normalize_html($res);
     $exp = normalize_html_file('output/tales-string-03.html');
     $this->assertEquals($exp, $res);
 }
Пример #8
0
 function test()
 {
     $tpl = $this->newPHPTAL('input/overloading-01.html');
     $tpl->object = new OverloadTestClass();
     $res = normalize_html($tpl->execute());
     $exp = normalize_html_file('output/overloading-01.html');
     $this->assertEquals($exp, $res);
 }
Пример #9
0
 function testSimple()
 {
     $tpl = $this->newPHPTAL('input/content-encoding.xml');
     $res = $tpl->execute();
     $exp = normalize_html_file('output/content-encoding.xml');
     $res = normalize_html($res);
     $this->assertEquals($exp, $res);
 }
Пример #10
0
 function testDtdInline()
 {
     $tpl = $this->newPHPTAL('input/doctype.04.html');
     $res = $tpl->execute();
     $res = normalize_html($res);
     $exp = normalize_html_file('output/doctype.04.html');
     $this->assertEquals($exp, $res);
 }
Пример #11
0
 function testInContent()
 {
     $tpl = $this->newPHPTAL('input/php-mode.02.xml');
     $res = $tpl->execute();
     $exp = normalize_html_file('output/php-mode.02.xml');
     $res = normalize_html($res);
     $this->assertEquals($exp, $res);
 }
Пример #12
0
 function testTrue()
 {
     $tpl = $this->newPHPTAL('input/tales-true.html');
     $tpl->isNotTrue = false;
     $tpl->isTrue = true;
     $res = $tpl->execute();
     $this->assertEquals(normalize_html_file('output/tales-true.html'), normalize_html($res));
 }
Пример #13
0
 function testExists()
 {
     $tpl = $this->newPHPTAL('input/tal-condition.03.html');
     $tpl->somevar = true;
     $res = normalize_html($tpl->execute());
     $exp = normalize_html_file('output/tal-condition.03.html');
     $this->assertEquals($exp, $res);
 }
Пример #14
0
 function testExternalMacro()
 {
     $filter = new OldMyPreFilter2();
     $tpl = $this->newPHPTAL('input/prefilter.02.html');
     $tpl->setPreFilter($filter);
     $res = normalize_html($tpl->execute());
     $exp = normalize_html_file('output/prefilter.02.html');
     $this->assertEquals($exp, $res);
 }
Пример #15
0
 function testMix()
 {
     $tpl = $this->newPHPTAL('input/php.html');
     $tpl->real = 'real value';
     $tpl->foo = 'real';
     $res = normalize_html($tpl->execute());
     $exp = normalize_html_file('output/php.html');
     $this->assertEquals($exp, $res);
 }
Пример #16
0
 function testStripComments()
 {
     $t = $this->newPHPTAL('input/comment-filter-01.html');
     $t->addPreFilter(new PHPTAL_PreFilter_StripComments());
     $res = $t->execute();
     $res = normalize_html($res);
     $exp = normalize_html_file('output/comment-filter-01.html');
     $this->assertEquals($exp, $res);
 }
Пример #17
0
 function testIt()
 {
     $filter = new MyPostFilter();
     $tpl = $this->newPHPTAL('input/postfilter.01.html');
     $tpl->setPostFilter($filter);
     $tpl->value = 'my value';
     $res = normalize_html($tpl->execute());
     $exp = normalize_html_file('output/postfilter.01.html');
     $this->assertEquals($exp, $res);
 }
Пример #18
0
 function testEvalTranslate()
 {
     $tpl = $this->newPHPTAL('input/i18n-translate-02.html');
     $tpl->setTranslator(new DummyTranslator());
     $tpl->message = "my translate key &";
     $res = $tpl->execute();
     $res = normalize_html($res);
     $exp = normalize_html_file('output/i18n-translate-02.html');
     $this->assertEquals($exp, $res);
 }
Пример #19
0
 public function testAllowGtAndLtInTextNodes()
 {
     $parser = new PHPTAL_Dom_SaxXmlParser('UTF-8');
     $parser->parseFile($builder = new MyDocumentBuilder(), 'input/xml.03.xml')->getResult();
     $this->assertEquals(normalize_html_file('output/xml.03.xml'), normalize_html($builder->result));
     $this->assertEquals(3, $builder->elementStarts);
     $this->assertEquals(3, $builder->elementCloses);
     // a '<' character withing some text data make the parser call 2 times
     // the onElementData() method
     $this->assertEquals(7, $builder->datas);
 }
Пример #20
0
 function testReplaceStructure()
 {
     $tpl = $this->newPHPTAL('input/tal-on-error.03.html');
     $tpl->dummy = new OnErrorDummyObject();
     $res = normalize_html($tpl->execute());
     $exp = normalize_html_file('output/tal-on-error.03.html');
     $errors = $tpl->getErrors();
     $this->assertEquals(1, count($errors));
     $this->assertEquals('error thrown', $errors[0]->getMessage());
     $this->assertEquals($exp, $res);
 }
Пример #21
0
 function testNamespace()
 {
     $tpl = $this->newPHPTAL('input/i18n-name-06.html');
     $tpl->username = '******';
     $tpl->mails = 100;
     $tpl->setTranslator(new DummyTranslator());
     $res = $tpl->execute();
     $res = normalize_html($res);
     $exp = normalize_html_file('output/i18n-name-06.html');
     $this->assertEquals($exp, $res);
 }
Пример #22
0
 function testLevel2()
 {
     $o = new stdClass();
     $o->foo = 1;
     $tpl = $this->newPHPTAL('input/tales-exist-02.html');
     $tpl->o = $o;
     $res = $tpl->execute();
     $res = normalize_html($res);
     $exp = normalize_html_file('output/tales-exist-02.html');
     $this->assertEquals($exp, $res);
 }
Пример #23
0
 function testIt()
 {
     $arr = new MyArray();
     for ($i = 0; $i < 20; $i++) {
         $val = new stdClass();
         $val->foo = "foo value {$i}";
         $arr->push($val);
     }
     $tpl = $this->newPHPTAL('input/array-overload.01.html');
     $tpl->myobject = $arr;
     $res = $tpl->execute();
     $exp = normalize_html_file('output/array-overload.01.html');
     $res = normalize_html($res);
     $this->assertEquals($exp, $res);
 }
Пример #24
0
 function test01()
 {
     $trigger = new MyTrigger();
     $exp = normalize_html_file('output/phptal.id.01.html');
     $tpl = $this->newPHPTAL('input/phptal.id.01.html');
     $tpl->addTrigger('myTable', $trigger);
     $tpl->result = range(0, 3);
     $res = $tpl->execute();
     $res = normalize_html($res);
     $this->assertEquals($exp, $res);
     $this->assertEquals(false, $trigger->useCache);
     $res = $tpl->execute();
     $res = normalize_html($res);
     $this->assertEquals($exp, $res);
     $this->assertEquals(true, $trigger->useCache);
 }
Пример #25
0
 public function testSimple()
 {
     $trigger = new StupidCacheTrigger();
     $tpl = $this->newPHPTAL('input/trigger.01.html');
     $tpl->addTrigger('someid', $trigger);
     $exp = normalize_html_file('output/trigger.01.html');
     $tpl->someId = 10;
     $res = normalize_html($tpl->execute());
     $this->assertEquals($exp, $res);
     $this->assertTrue($trigger->isCaching);
     $this->assertEquals('trigger.10', $trigger->cachePath);
     $tpl->someId = 10;
     $res = normalize_html($tpl->execute());
     $this->assertEquals($exp, $res);
     $this->assertFalse($trigger->isCaching);
     $this->assertEquals('trigger.10', $trigger->cachePath);
 }
Пример #26
0
 function testPhpMode()
 {
     $tpl = $this->newPHPTAL('input/tal-repeat.07.html');
     $tpl->result = array('a' => 0, 'b' => 1, 'c' => 2, 'd' => 3);
     $res = normalize_html($tpl->execute());
     $exp = normalize_html_file('output/tal-repeat.07.html');
     $this->assertEquals($exp, $res);
 }
Пример #27
0
 function testChainedStructure()
 {
     $exp = normalize_html_file('output/tal-attributes.10.html');
     $tpl = $this->newPHPTAL('input/tal-attributes.10.html');
     $tpl->value1 = false;
     $tpl->value2 = "return confirm('hel<lo');";
     $res = $tpl->execute();
     $this->assertEquals($exp, $res);
 }
Пример #28
0
 function test32()
 {
     $o = array('title' => 'my object', 'children' => array(array('title' => 'o.1', 'children' => array(array('title' => 'o.1.1', 'children' => array()), array('title' => 'o.1.2', 'children' => array()))), array('title' => 'o.2', 'children' => array())));
     $tpl = $this->newPHPTAL('input/old-32.html');
     $tpl->object = $o;
     $res = normalize_html($tpl->execute());
     $exp = normalize_html_file('output/old-32.html');
     $this->assertEquals($exp, $res);
 }
Пример #29
0
 function testOverwrite()
 {
     $res = $this->newPHPTAL('input/namespaces.03.html')->execute();
     $this->assertEquals(normalize_html_file('output/namespaces.03.html'), normalize_html($res));
 }
Пример #30
0
 function testFillAndCondition()
 {
     $tpl = $this->newPHPTAL('input/metal-slot.04.html');
     $tpl->fillit = true;
     $res = normalize_html($tpl->execute());
     $exp = normalize_html_file('output/metal-slot.04.html');
     $this->assertEquals($exp, $res);
 }