| [ 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/tests/cases/compiler/compile_tree_node/WactCompileTreeNodeTest.class.php'); 11 12 Mock :: generate('WactExpression', 'MockExpression'); 13 14 class WactOutputExpressionNodeTest extends WactCompileTreeNodeTest 15 { 16 protected $expression; 17 18 function _createNode() 19 { 20 $location = new WactSourceLocation('my_file', 10); 21 $this->expression = new MockExpression(); 22 return new WactOutputExpressionNode($location, $this->expression); 23 } 24 25 function testLocationPassed() 26 { 27 $this->assertEqual($this->component->getTemplateFile(), 'my_file'); 28 $this->assertEqual($this->component->getTemplateLine(), 10); 29 } 30 31 // overwrite since generates not like usual compiler 32 function testGenerate() 33 { 34 } 35 36 function testGenerateWithDynamicExpression() 37 { 38 $code_writer = new WactCodeWriter(); 39 $this->expression->expectOnce('isConstant'); 40 $this->expression->setReturnValue('isConstant', false); 41 $this->expression->expectOnce('generatePreStatement', array($code_writer)); 42 $this->expression->expectOnce('generateExpression', array($code_writer)); 43 $this->expression->expectOnce('generatePostStatement', array($code_writer)); 44 $this->component->generate($code_writer); 45 $this->assertEqual($code_writer->renderCode(), '<?php echo ; ?>'); 46 } 47 48 function testGenerateWithConstantExpression() 49 { 50 $code_writer = new WactCodeWriter(); 51 $this->expression->expectOnce('isConstant'); 52 $this->expression->setReturnValue('isConstant', true); 53 $this->expression->setReturnValue('getValue', 'value'); 54 $this->component->generate($code_writer); 55 $this->assertEqual($code_writer->renderCode(), 'value'); 56 } 57 } 58 ?>
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 |