location = new WactSourceLocation('my_file', 10); $this->parser = new MockWactSourceFileParser(); $this->tree_builder = new MockTreeBuilder(); $this->state = new WactLiteralParsingState($this->parser, $this->tree_builder); } function testGetAttributeStringRunatTrimmed() { $attrs = array('foo'=>'bar', 'runat'=>'client'); $this->assertIdentical($this->state->getAttributeString($attrs), ' foo="bar"'); } function testStartElement() { $tag = 'test'; $attrs = array('foo' => 'bar'); $this->state->setLiteralTag('foo'); $this->tree_builder->expectOnce('addWactTextNode', array( '')); $this->state->startTag($tag, $attrs, $this->location); } function testEndElement() { $tag = 'test'; $this->state->setLiteralTag('foo'); $this->tree_builder->expectOnce('addWactTextNode', array( '')); $this->state->endTag($tag, $this->location); } function testEndElementLiteral() { $tag = 'test'; $this->state->setLiteralTag('test'); $this->tree_builder->expectOnce('popNode'); $this->parser->expectOnce('changeToComponentParsingState'); $this->state->endTag($tag, $this->location); } function testEmptyElement() { $tag = 'test'; $attrs = array('foo' => 'bar'); $this->state->setLiteralTag('foo'); $this->tree_builder->expectOnce('addWactTextNode', array( '')); $this->state->emptyTag($tag, $attrs, $this->location); } function testCharacters() { $text = 'test'; $this->tree_builder->expectOnce('addWactTextNode', array($text)); $this->state->characters($text, $this->location); } function testInstruction() { $target = 'test'; $instruction = 'doit'; $pi = ''; $this->tree_builder->expectOnce('addWactTextNode', array($pi)); $this->state->instruction($target, $instruction, $this->location); } } ?>