var test='BIG WORDS'
Hello, world!
]]>
EOD;
}
}
/**
* GadgetRendererTest test case.
*/
class GadgetRewriterTest extends PHPUnit_Framework_TestCase {
/**
* @var Gadget
*/
private $gadget;
/**
* @var GadgetContext
*/
private $gadgetContext;
/**
* @var GadgetRewriter
*/
private $gadgetRewriter;
/**
* @var view
*/
private $view;
/**
* Prepares the environment before running a test.
*/
protected function setUp() {
parent::setUp();
$this->gadgetContext = new GadgetContext('GADGET');
$gadgetSpecFactory = new MockRewriterGadgetFactory($this->gadgetContext, null);
$gadgetSpecFactory->fetchGadget = null;
$this->gadget = $gadgetSpecFactory->createGadget();
$this->gadgetRewriter = new GadgetRewriter($this->gadgetContext);
$this->view = $this->gadget->getView($this->gadgetContext->getView());
}
/**
* Cleans up the environment after running a test.
*/
protected function tearDown() {
$this->gadget = null;
$this->gadgetContext = null;
$this->gadgetRewriter = null;
$this->view = null;
parent::tearDown();
}
/**
* Tests GadgetHtmlRenderer->renderGadget()
*/
public function testRewrite() {
preg_match_all('||', $this->gadgetRewriter->rewrite($this->view["content"], $this->gadget), $tmp, PREG_SET_ORDER);
$desc_string = $tmp[0][1];
$source_string = "var test='BIG WORDS'";
$this->assertEquals($source_string, $desc_string);
}
}
?>