public function testdisplayEmailCounts() { //unset and reconnect Db to resolve mysqli fetch exeception global $db; unset($db->database); $db->checkConnection(); $user = new User(); $expected = '<script type="text/javascript" language="Javascript">var welcome = document.getElementById("welcome");var welcomeContent = welcome.innerHTML;welcome.innerHTML = welcomeContent + " <a href=index.php?module=Emails&action=ListViewGroup>Group Inbox: (0 New)</a>";</script>'; //cpature the screen output and compare with exected values ob_start(); $user->displayEmailCounts(); $renderedContent = ob_get_contents(); ob_end_clean(); $this->assertSame($expected, $renderedContent); }