/** * Finds a link by id attribute. * @param string $id ID attribute value. * @return string/boolean URL on success. * @access public */ function getLinkById($id) { return $this->page->getUrlById($id); }
function testLinkIds() { $link = new SimpleAnchorTag(array('href' => './somewhere.php', 'id' => 33)); $link->addContent('Label'); $response = new MockSimpleHttpResponse(); $response->setReturnValue('getUrl', new SimpleUrl('http://host/')); $page = new SimplePage($response); $page->AcceptTag($link); $this->assertEqual($page->getUrlsByLabel('Label'), array(new SimpleUrl('http://host/somewhere.php'))); $this->assertFalse($page->getUrlById(0)); $this->assertEqual($page->getUrlById(33), new SimpleUrl('http://host/somewhere.php')); }