render() public method

Method to render the feed
public render ( boolean $ret = false ) : mixed
$ret boolean
return mixed
Exemplo n.º 1
0
    public function testRssRender()
    {
        $tmpl = <<<NEWS
    <div class="news-div">
        <a href="[{link}]">[{title}]</a><br />
        <strong>[{published}]</strong> ([{time}])<br />
        <p>[{description}]</p>
    </div>

NEWS;
        $feed = new Feed\Reader(new Feed\Format\Rss('http://news.google.com/news?pz=1&cf=all&ned=us&hl=en&topic=h&output=rss', 4));
        $feed->setTemplate($tmpl);
        $this->assertContains('Google', $feed->title);
        $code = $feed->render(true);
        ob_start();
        $feed->render();
        $output = ob_get_clean();
        ob_start();
        echo $feed;
        $echoOutput = ob_get_clean();
        $this->assertContains('<div class="news-div">', $code);
        $this->assertContains('<div class="news-div">', $output);
        $this->assertContains('<div class="news-div">', $echoOutput);
    }