/** * Test... * * @return void */ public function testRender() { $this->object->setShortName('ShortName'); $this->object->setDescription('Description'); $item = new JOpenSearchUrl(); $item->template = 'http://www.example.com'; $item2 = new JOpenSearchUrl(); $item2->template = 'http://www.example.com?format=feed'; $item2->type = 'application/rss+xml'; $item2->rel = 'suggestions'; $this->object->addUrl($item); $this->object->addUrl($item2); $expected = '<?xml version="1.0" encoding="utf-8"?>' . PHP_EOL . '<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"><ShortName>ShortName</ShortName>' . '<Description>Description</Description><InputEncoding>UTF-8</InputEncoding>' . '<Url type="application/opensearchdescription+xml" rel="self" template="http://mydomain.com/index.php"/>' . '<Url type="text/html" template="http://www.example.com"/>' . '<Url type="application/rss+xml" rel="suggestions" template="http://www.example.com?format=feed"/>' . '</OpenSearchDescription>' . PHP_EOL; $this->assertXmlStringEqualsXmlString($this->object->render(), $expected); }
/** * Test... * * @return void */ public function testRender() { $this->object->setShortName('ShortName'); $this->object->setDescription('Description'); $item = new JOpenSearchUrl(); $item->template = 'http://www.example.com'; $item2 = new JOpenSearchUrl(); $item2->template = 'http://www.example.com?format=feed'; $item2->type = 'application/rss+xml'; $item2->rel = 'suggestions'; $this->object->addUrl($item); $this->object->addUrl($item2); $this->assertThat($this->object->render(), $this->equalTo('<?xml version="1.0" encoding="utf-8"?> <OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"><ShortName>ShortName</ShortName><Description>Description</Description><InputEncoding>UTF-8</InputEncoding><Url type="application/opensearchdescription+xml" rel="self" template=""/><Url type="text/html" template="http://www.example.com"/><Url type="application/rss+xml" rel="suggestions" template="http://www.example.com?format=feed"/></OpenSearchDescription> ')); }
/** * @testdox Test the default return for render */ public function testTheDefaultReturnForRender() { $this->assertContains('<?xml version="1.0" encoding="utf-8"?>', $this->object->render()); }