| [ 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/parser/WactBaseParsingStateTestCase.class.php'); 11 12 class WactLiteralParsingStateTest extends WactBaseParsingStateTestCase 13 { 14 protected $state; 15 protected $tree_builder; 16 protected $parser; 17 18 function setUp() 19 { 20 $this->location = new WactSourceLocation('my_file', 10); 21 $this->parser = new MockWactSourceFileParser(); 22 $this->tree_builder = new MockTreeBuilder(); 23 $this->state = new WactLiteralParsingState($this->parser, $this->tree_builder); 24 } 25 26 function testGetAttributeStringRunatTrimmed() 27 { 28 $attrs = array('foo'=>'bar', 'runat'=>'client'); 29 $this->assertIdentical($this->state->getAttributeString($attrs), ' foo="bar"'); 30 } 31 32 function testStartElement() 33 { 34 $tag = 'test'; 35 $attrs = array('foo' => 'bar'); 36 $this->state->setLiteralTag('foo'); 37 $this->tree_builder->expectOnce('addWactTextNode', array( '<test foo="bar">')); 38 $this->state->startTag($tag, $attrs, $this->location); 39 } 40 41 function testEndElement() 42 { 43 $tag = 'test'; 44 $this->state->setLiteralTag('foo'); 45 $this->tree_builder->expectOnce('addWactTextNode', array( '</' . $tag . '>')); 46 $this->state->endTag($tag, $this->location); 47 } 48 49 function testEndElementLiteral() 50 { 51 $tag = 'test'; 52 $this->state->setLiteralTag('test'); 53 $this->tree_builder->expectOnce('popNode'); 54 $this->parser->expectOnce('changeToComponentParsingState'); 55 $this->state->endTag($tag, $this->location); 56 } 57 58 function testEmptyElement() 59 { 60 $tag = 'test'; 61 $attrs = array('foo' => 'bar'); 62 $this->state->setLiteralTag('foo'); 63 $this->tree_builder->expectOnce('addWactTextNode', array( '<test foo="bar" />')); 64 $this->state->emptyTag($tag, $attrs, $this->location); 65 } 66 67 function testCharacters() 68 { 69 $text = 'test'; 70 $this->tree_builder->expectOnce('addWactTextNode', array($text)); 71 $this->state->characters($text, $this->location); 72 } 73 74 function testInstruction() 75 { 76 $target = 'test'; 77 $instruction = 'doit'; 78 $pi = '<?' . $target . ' ' . $instruction . '?>'; 79 $this->tree_builder->expectOnce('addWactTextNode', array($pi)); 80 $this->state->instruction($target, $instruction, $this->location); 81 } 82 } 83 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Mon Dec 1 03:56:46 2008 | Cross-referenced by PHPXref 0.7 |