| [ Index ] |
PHP Cross Reference of Limb3 |
[Summary view] [Print] [Text view]
1 <?php 2 /* 3 * Limb PHP Framework 4 * 5 * @link http://limb-project.com 6 * @copyright Copyright © 2004-2007 BIT(http://bit-creative.com) 7 * @license LGPL http://www.gnu.org/copyleft/lesser.html 8 */ 9 10 require_once('limb/wact/src/compiler/templatecompiler.inc.php'); 11 12 class WactTagDictionaryTest extends UnitTestCase 13 { 14 protected $dictionary; 15 protected $tag_info; 16 17 function setUp() 18 { 19 $this->tag_info = new WactTagInfo('testtag', 'SomeTagClass'); 20 $this->dictionary = new WactTagDictionary(); 21 $this->dictionary->registerWactTagInfo($this->tag_info, $file = 'whaever'); 22 } 23 24 protected function _createParentTag() 25 { 26 $tag_info = new WactTagInfo('some_tag', 'SomeTagClass'); 27 return new WactRuntimeComponentHTMLTag(new WactSourceLocation('file', '10'), 'some_tag', $tag_info); 28 } 29 30 function testGetWactTagInfo() 31 { 32 $this->assertIsA($this->dictionary->getWactTagInfo('testtag'), 'WactTagInfo'); 33 } 34 35 function testRegisterTagInfoOnceOnly() 36 { 37 $dictionary = new WactTagDictionary(); 38 $tag_info1 = new WactTagInfo('some_tag', 'SomeTagClass'); 39 $tag_info2 = new WactTagInfo('some_tag', 'SomeTagClass'); 40 $dictionary->registerWactTagInfo($tag_info1, $file1 = 'whaever1'); 41 $dictionary->registerWactTagInfo($tag_info2, $file2 = 'whaever2'); 42 43 $this->assertEqual($dictionary->getWactTagInfo('some_tag'), $tag_info1); 44 } 45 46 function testNotATag() 47 { 48 $parent = $this->_createParentTag(); 49 $tag = 'notatag'; 50 $attrs = array(); 51 $this->assertFalse($this->dictionary->findTagInfo($tag, $attrs, FALSE, $parent)); 52 } 53 54 function testRunatEqualsClient() 55 { 56 $parent = $this->_createParentTag(); 57 $tag = 'foo'; 58 $attrs = array('runat' => 'client'); 59 $this->assertNull($this->dictionary->findTagInfo($tag, $attrs, FALSE, $parent)); 60 } 61 62 function testComponentWithRunatServer() 63 { 64 $parent = $this->_createParentTag(); 65 $this->dictionary->registerWactTagInfo($info = new WactTagInfo('isatag', 'blah'), $file = 'whatever'); 66 $tag = 'iSaTag'; 67 $attrs = array('runat'=>'server'); 68 $this->assertEqual($this->dictionary->findTagInfo($tag, $attrs, FALSE, $parent), $info); 69 } 70 71 function testWactGenericHTMLTag() 72 { 73 $parent = $this->_createParentTag(); 74 $tag = 'iSaWactGenericHTMLTag'; 75 $attrs = array('runat' => 'server'); 76 $this->assertIsA($this->dictionary->findTagInfo($tag, $attrs, TRUE, $parent), 'WactTagInfo'); 77 } 78 79 function testWactGenericContainerHTMLTag() 80 { 81 $parent = $this->_createParentTag(); 82 $tag = 'p'; 83 $attrs = array('runat' => 'server'); 84 $info = $this->dictionary->findTagInfo($tag, $attrs, FALSE, $parent); 85 $this->assertEqual($info->TagClass, 'WactGenericContainerHTMLTag'); 86 $this->assertEqual($info->Tag, 'p'); 87 } 88 89 function testRunatAsHasMorePriority() 90 { 91 $parent = $this->_createParentTag(); 92 93 $info = new WactTagInfo('my_tag', 'blah'); 94 $info->setRunat('client'); 95 $info->setRunatAs('WactRuntimeComponentHTMLTag'); 96 97 $this->dictionary->registerWactTagInfo($info, $file = 'whatever'); 98 99 $tag = 'my_tag'; 100 $attrs = array(); 101 102 $this->assertEqual($this->dictionary->findTagInfo($tag, $attrs, FALSE, $parent), $info); 103 } 104 105 } 106 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Thu Jan 8 04:06:23 2009 | Cross-referenced by PHPXref 0.7 |