'.str_repeat('This is an awesome text with some links, here there are the awesome
', 7).'', 'http://0.0.0.0');
+ $readability->debug = true;
+ $res = $readability->init();
+
+ $this->assertTrue($res);
+ $this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent());
+ $this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle());
+ $this->assertContains('alt="article"', $readability->getContent()->innerHTML);
+ $this->assertEquals('this is my title', $readability->getTitle()->innerHTML);
+ $this->assertContains('This is an awesome text with some links, here there are', $readability->getContent()->innerHTML);
+ $this->assertNotContains('This text is also an awesome text and you should know that', $readability->getContent()->innerHTML);
+ }
+
+ public function testTitleWithDash()
+ {
+ $readability = new ReadabilityTested(''.str_repeat('This is an awesome text with some links, here there are the awesome
', 7).'', 'http://0.0.0.0');
+ $readability->debug = true;
+ $res = $readability->init();
+
+ $this->assertTrue($res);
+ $this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent());
+ $this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle());
+ $this->assertContains('alt="article"', $readability->getContent()->innerHTML);
+ $this->assertEquals('title2 - title3', $readability->getTitle()->innerHTML);
+ $this->assertContains('This is an awesome text with some links, here there are', $readability->getContent()->innerHTML);
+ $this->assertNotContains('This text is also an awesome text and you should know that', $readability->getContent()->innerHTML);
+ }
+
+ public function testTitleWithDoubleDot()
+ {
+ $readability = new ReadabilityTested(''.str_repeat('This is an awesome text with some links, here there are the awesome
', 7).'', 'http://0.0.0.0');
+ $readability->debug = true;
+ $res = $readability->init();
+
+ $this->assertTrue($res);
+ $this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent());
+ $this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle());
+ $this->assertContains('alt="article"', $readability->getContent()->innerHTML);
+ $this->assertEquals('title2 : title3', $readability->getTitle()->innerHTML);
+ $this->assertContains('This is an awesome text with some links, here there are', $readability->getContent()->innerHTML);
+ $this->assertNotContains('This text is also an awesome text and you should know that', $readability->getContent()->innerHTML);
+ }
+
+ public function testTitleTooShortUseH1()
+ {
+ $readability = new ReadabilityTested(''.str_repeat('This is an awesome text with some links, here there are the awesome
', 7).'', 'http://0.0.0.0');
+ $readability->debug = true;
+ $res = $readability->init();
+
+ $this->assertTrue($res);
+ $this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent());
+ $this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle());
+ $this->assertContains('alt="article"', $readability->getContent()->innerHTML);
+ $this->assertEquals('this is my h1 title !', $readability->getTitle()->innerHTML);
$this->assertContains('This is an awesome text with some links, here there are', $readability->getContent()->innerHTML);
$this->assertNotContains('This text is also an awesome text and you should know that', $readability->getContent()->innerHTML);
}