/** * Tests GadgetHtmlRenderer->addHeadTags() */ public function testAddHeadTags() { ob_start(); $this->gadgetHtmlRenderer->renderGadget($this->gadget, $this->view); ob_end_clean(); $this->gadgetHtmlRenderer->addHeadTags($this->domElement, $this->domDocument); // TODO: currently we just test the script part $tmpNodeList = $this->domElement->getElementsByTagName("script"); $scripts = $this->gadgetHtmlRenderer->getJavaScripts(); $idx = 0; foreach ($tmpNodeList as $tmpNode) { $script = $scripts[$idx++]; if ($script['type'] == 'inline') { $this->assertEquals('text/javascript', $tmpNode->getAttribute('type')); $this->assertEquals(trim($script['content']), trim($tmpNode->nodeValue)); } else { $this->assertEquals($script['content'], $tmpNode->getAttribute('src')); } } }