function testMultipleLinks() { $a1 = new SimpleAnchorTag(array("href" => "http://somewhere")); $a1->addContent("1"); $a2 = new SimpleAnchorTag(array("href" => "http://elsewhere")); $a2->addContent("2"); $page = &new MockSimplePage($this); $page->expectArgumentsAt(0, "acceptTag", array($a1)); $page->expectArgumentsAt(1, "acceptTag", array($a2)); $page->expectCallCount("acceptTag", 2); $builder = &new SimplePageBuilder($page); $builder->startElement("a", array("href" => "http://somewhere")); $builder->addContent("1"); $builder->endElement("a"); $builder->addContent("Padding"); $builder->startElement("a", array("href" => "http://elsewhere")); $builder->addContent("2"); $builder->endElement("a"); $page->tally(); }
function testMultipleLinks() { $a1 = new SimpleAnchorTag(array("href" => "http://somewhere")); $a1->addContent("1"); $a2 = new SimpleAnchorTag(array("href" => "http://elsewhere")); $a2->addContent("2"); $page =& new MockSimplePage(); $page->expectArgumentsAt(0, "acceptTag", array($a1)); $page->expectArgumentsAt(1, "acceptTag", array($a2)); $page->expectCallCount("acceptTag", 2); $builder =& new PartialSimplePageBuilder(); $builder->setReturnReference('_createPage', $page); $builder->setReturnReference('_createParser', new MockSimpleHtmlSaxParser()); $builder->SimplePageBuilder(); $builder->parse(new MockSimpleHttpResponse()); $builder->startElement("a", array("href" => "http://somewhere")); $builder->addContent("1"); $builder->endElement("a"); $builder->addContent("Padding"); $builder->startElement("a", array("href" => "http://elsewhere")); $builder->addContent("2"); $builder->endElement("a"); }
public function testMultipleLinks() { $a1 = new SimpleAnchorTag(array('href' => 'http://somewhere')); $a1->addContent('1'); $a2 = new SimpleAnchorTag(array('href' => 'http://elsewhere')); $a2->addContent('2'); $page =& new MockSimplePage(); $page->expectArgumentsAt(0, 'acceptTag', array($a1)); $page->expectArgumentsAt(1, 'acceptTag', array($a2)); $page->expectCallCount('acceptTag', 2); $builder =& new PartialSimplePageBuilder(); $builder->setReturnReference('_createPage', $page); $builder->setReturnReference('_createParser', new MockSimpleHtmlSaxParser()); $builder->SimplePageBuilder(); $builder->parse(new MockSimpleHttpResponse()); $builder->startElement('a', array('href' => 'http://somewhere')); $builder->addContent('1'); $builder->endElement('a'); $builder->addContent('Padding'); $builder->startElement('a', array('href' => 'http://elsewhere')); $builder->addContent('2'); $builder->endElement('a'); }
function testFindLinkWithImage() { $link = new SimpleAnchorTag(array('href' => './somewhere.php', 'id' => 33)); $link->addContent('<img src="pic.jpg" alt="<A picture>">'); $response = new MockSimpleHttpResponse(); $response->setReturnValue('getUrl', new SimpleUrl('http://host/')); $page = new SimplePage($response); $page->AcceptTag($link); $this->assertEqual($page->getUrlsByLabel('<A picture>'), array(new SimpleUrl('http://host/somewhere.php'))); }