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();
 }
Exemple #2
0
 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");
 }
Exemple #3
0
 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');
 }
Exemple #4
0
 public function testIsIdMatchesIdAttribute()
 {
     $tag = new SimpleAnchorTag(array('href' => 'http://here/', 'id' => 7));
     $this->assertIdentical($tag->getAttribute('id'), '7');
     $this->assertTrue($tag->isId(7));
 }
Exemple #5
0
 function testFindLinkWithImage()
 {
     $link = new SimpleAnchorTag(array('href' => './somewhere.php', 'id' => 33));
     $link->addContent('<img src="pic.jpg" alt="&lt;A picture&gt;">');
     $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')));
 }