Exemplo n.º 1
0
 function testFlickrCrawl()
 {
     global $crawler;
     $crawler->emit("crawl");
     $ldao = new LinkDAO($this->db, $this->logger);
     $link = $ldao->getLinkById(43);
     $this->assertEqual($link->expanded_url, 'http://farm5.static.flickr.com/4027/4490817394_70452f4cfd_m.jpg');
     $this->assertEqual($link->error, '');
     $link = $ldao->getLinkById(42);
     $this->assertEqual($link->expanded_url, '');
     $this->assertEqual($link->error, 'Photo not found');
     $link = $ldao->getLinkById(41);
     $this->assertEqual($link->expanded_url, '');
     $this->assertEqual($link->error, 'Photo not found');
 }
Exemplo n.º 2
0
 function testExpandURLsCrawl()
 {
     global $crawler;
     $crawler->emit("crawl");
     $ldao = new LinkDAO($this->db, $this->logger);
     $link = $ldao->getLinkById(1);
     $this->assertEqual($link->expanded_url, 'http://www.thewashingtonnote.com/archives/2010/04/communications/');
     $this->assertEqual($link->error, '');
 }
Exemplo n.º 3
0
 function testSaveExpansionError()
 {
     $ldao = new LinkDAO($this->db, $this->logger);
     $linktogeterror = $ldao->getLinkById(10);
     $this->assertEqual($linktogeterror->error, '');
     $ldao->saveExpansionError($linktogeterror->url, "This is expansion error text");
     $linkthathaserror = $ldao->getLinkById(10);
     $this->assertEqual($linkthathaserror->error, "This is expansion error text");
 }