Hello, world!
]]>
';
/**
* @var Context
*/
private $Context;
/**
* Prepares the environment before running a test.
*/
protected function setUp() {
parent::setUp();
$this->GadgetSpecParser = new GadgetSpecParser();
$this->Context = new GadgetContext('GADGET');
}
/**
* Cleans up the environment after running a test.
*/
protected function tearDown() {
$this->GadgetSpecParser = null;
parent::tearDown();
}
/**
* Tests GadgetSpecParser->parse() exception
*/
public function testParseExeption() {
$this->setExpectedException('apache\shindig\gadgets\GadgetSpecException');
$this->assertTrue($this->GadgetSpecParser->parse('<', $this->Context));
}
/**
* Tests GadgetSpecParser->parse()
*/
public function testParse() {
$gadgetParsed = $this->GadgetSpecParser->parse($this->Gadget, $this->Context);
$view = $gadgetParsed->views['home'];
$this->assertEquals('Hello, world!
', trim($view['content']));
$this->assertEquals('2.0.0', (string) $gadgetParsed->specificationVersion);
$this->assertEquals('html', $gadgetParsed->doctype);
}
}