| [ 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 require_once 'limb/wact/src/compiler/attribute/WactAttributeExpressionFragment.class.php'; 12 13 class WactAttributeExpressionFragmentTest extends UnitTestCase 14 { 15 protected $filter_dictionary; 16 17 function setUp() 18 { 19 $this->filter_dictionary = new WactFilterDictionary(); 20 } 21 22 function testIsConstant() 23 { 24 $component = new WactCompilerTag(null, null, null); 25 $attribute = new WactAttributeExpressionFragment('"hello"', $component, $this->filter_dictionary); 26 27 $this->assertTrue($attribute->isConstant()); 28 } 29 30 function testGetValue() 31 { 32 $component = new WactCompilerTag(null, null, null); 33 $attribute = new WactAttributeExpressionFragment('"hello"', $component, $this->filter_dictionary); 34 35 $this->assertEqual($attribute->getValue(), 'hello'); 36 } 37 38 function testGenerateConstantFragment() 39 { 40 $component = new WactCompilerTag(null, null, null); 41 $attribute = new WactAttributeExpressionFragment('"hello"', $component, $this->filter_dictionary); 42 $code_writer = new WactCodeWriter(); 43 44 $attribute->generateFragment($code_writer); 45 46 $this->assertEqual($code_writer->renderCode(), 'hello'); 47 } 48 49 function testGenerateFragment() 50 { 51 $component = new WactCompilerTag(null, null, null); 52 $property = new WactCompilerProperty(); 53 $component->registerProperty('hello', $property); 54 $attribute = new WactAttributeExpressionFragment('hello', $component, $this->filter_dictionary); 55 56 $code_writer = new WactCodeWriter(null, null, null); 57 $attribute->generateFragment($code_writer); 58 $this->assertEqual($code_writer->renderCode(), '<?php echo htmlspecialchars(, ENT_QUOTES); ?>'); 59 } 60 61 function testGenerateExpression() 62 { 63 $code_writer = new WactCodeWriter(); 64 65 $component = new WactCompilerTag(null, null, null); 66 $property = new WactCompilerProperty(); 67 $component->registerProperty('hello', $property); 68 $attribute = new WactAttributeExpressionFragment('hello', $component, $this->filter_dictionary); 69 70 $attribute->generatePreStatement($code_writer); 71 $attribute->generateExpression($code_writer); 72 $attribute->generatePostStatement($code_writer); 73 74 $this->assertEqual($code_writer->renderCode(), ''); 75 } 76 } 77 ?>
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 |