3 require_once 'stapibas/autoloader.php';
5 class Content_Extractor_LinkTest extends \PHPUnit_Framework_TestCase
7 public function testExtractShadowBox()
9 $doc = new \DOMDocument();
10 @$doc->loadHtmlFile(__DIR__ . '/data/shadowbox-popup-positioning.htm');
11 $source = 'http://www.bogo/tagebuch/shadowbox-popup-positioning.htm';
12 $target = 'http://www.bogo/tagebuch/demo/shadowbox-manual-positioning/static.html';
14 $logger = new Logger();
15 $logger->debug = true;
16 $cel = new Content_Extractor_Link($logger);
17 $link = $cel->extract($doc, $source, $target);
19 $this->assertNotNull($link, 'No extracted data');
22 'Shadowbox: Manual popup positioning',
26 $this->assertEquals('Christian Weiske', $link['author_name']);
27 $this->assertNull($link['author_image']);
28 $this->assertEquals('http://www.bogo/', $link['author_url']);
31 public function testExtractXmlShadowBox()
33 $doc = new \DOMDocument();
34 @$doc->load(__DIR__ . '/data/shadowbox-popup-positioning.htm');
35 $source = 'http://www.bogo/tagebuch/shadowbox-popup-positioning.htm';
36 $target = 'http://www.bogo/tagebuch/demo/shadowbox-manual-positioning/static.html';
38 $logger = new Logger();
39 $logger->debug = true;
40 $cel = new Content_Extractor_Link($logger);
41 $link = $cel->extract($doc, $source, $target);
43 $this->assertNotNull($link, 'No extracted data');
46 'Shadowbox: Manual popup positioning',
50 $this->assertEquals('Christian Weiske', $link['author_name']);
51 $this->assertNull($link['author_image']);
52 $this->assertEquals('http://www.bogo/', $link['author_url']);
55 public function testExtractLaurent()
57 $doc = new \DOMDocument();
58 @$doc->loadHtmlFile(__DIR__ . '/data/laurent-eschenauer.html');
59 $source = 'http://eschnou.com/entry/testing-indieweb-federation-with-waterpigscouk-aaronpareckicom-and--62-24908.html';
60 $target = 'http://indiewebcamp.com';
62 $logger = new Logger();
63 $logger->debug = true;
64 $cel = new Content_Extractor_Link($logger);
65 $link = $cel->extract($doc, $source, $target);
67 $this->assertNotNull($link, 'No extracted data');
70 'Testing #indieweb federation with @waterpigs.co.uk, @aaronparecki.com and @indiewebcamp.com !',
74 $this->assertNull($link['author_name']);
75 $this->assertNull($link['author_image']);
76 $this->assertNull($link['author_url']);