|
|
|
@ -74,7 +74,7 @@ class ReadabilityTest extends \PHPUnit\Framework\TestCase |
|
|
|
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent()); |
|
|
|
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent()); |
|
|
|
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle()); |
|
|
|
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle()); |
|
|
|
$this->assertEmpty($readability->getTitle()->getInnerHtml()); |
|
|
|
$this->assertEmpty($readability->getTitle()->getInnerHtml()); |
|
|
|
$this->assertContains('Sorry, Readability was unable to parse this page for content.', $readability->getContent()->getInnerHtml()); |
|
|
|
$this->assertStringContainsString('Sorry, Readability was unable to parse this page for content.', $readability->getContent()->getInnerHtml()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function testInitP() |
|
|
|
public function testInitP() |
|
|
|
@ -85,9 +85,9 @@ class ReadabilityTest extends \PHPUnit\Framework\TestCase |
|
|
|
$this->assertTrue($res); |
|
|
|
$this->assertTrue($res); |
|
|
|
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent()); |
|
|
|
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent()); |
|
|
|
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle()); |
|
|
|
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle()); |
|
|
|
$this->assertContains('<div readability=', $readability->getContent()->getInnerHtml()); |
|
|
|
$this->assertStringContainsString('<div readability=', $readability->getContent()->getInnerHtml()); |
|
|
|
$this->assertEmpty($readability->getTitle()->getInnerHtml()); |
|
|
|
$this->assertEmpty($readability->getTitle()->getInnerHtml()); |
|
|
|
$this->assertContains('This is the awesome content :)', $readability->getContent()->getInnerHtml()); |
|
|
|
$this->assertStringContainsString('This is the awesome content :)', $readability->getContent()->getInnerHtml()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function testInitDivP() |
|
|
|
public function testInitDivP() |
|
|
|
@ -98,9 +98,9 @@ class ReadabilityTest extends \PHPUnit\Framework\TestCase |
|
|
|
$this->assertTrue($res); |
|
|
|
$this->assertTrue($res); |
|
|
|
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent()); |
|
|
|
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent()); |
|
|
|
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle()); |
|
|
|
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle()); |
|
|
|
$this->assertContains('<div readability=', $readability->getContent()->getInnerHtml()); |
|
|
|
$this->assertStringContainsString('<div readability=', $readability->getContent()->getInnerHtml()); |
|
|
|
$this->assertEmpty($readability->getTitle()->getInnerHtml()); |
|
|
|
$this->assertEmpty($readability->getTitle()->getInnerHtml()); |
|
|
|
$this->assertContains('This is the awesome content :)', $readability->getContent()->getInnerHtml()); |
|
|
|
$this->assertStringContainsString('This is the awesome content :)', $readability->getContent()->getInnerHtml()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function testInitDiv() |
|
|
|
public function testInitDiv() |
|
|
|
@ -112,9 +112,9 @@ class ReadabilityTest extends \PHPUnit\Framework\TestCase |
|
|
|
$this->assertTrue($res); |
|
|
|
$this->assertTrue($res); |
|
|
|
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent()); |
|
|
|
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent()); |
|
|
|
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle()); |
|
|
|
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle()); |
|
|
|
$this->assertContains('<div readability=', $readability->getContent()->getInnerHtml()); |
|
|
|
$this->assertStringContainsString('<div readability=', $readability->getContent()->getInnerHtml()); |
|
|
|
$this->assertEmpty($readability->getTitle()->getInnerHtml()); |
|
|
|
$this->assertEmpty($readability->getTitle()->getInnerHtml()); |
|
|
|
$this->assertContains('This is the awesome content :)', $readability->getContent()->getInnerHtml()); |
|
|
|
$this->assertStringContainsString('This is the awesome content :)', $readability->getContent()->getInnerHtml()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function testWithFootnotes() |
|
|
|
public function testWithFootnotes() |
|
|
|
@ -127,11 +127,11 @@ class ReadabilityTest extends \PHPUnit\Framework\TestCase |
|
|
|
$this->assertTrue($res); |
|
|
|
$this->assertTrue($res); |
|
|
|
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent()); |
|
|
|
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent()); |
|
|
|
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle()); |
|
|
|
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle()); |
|
|
|
$this->assertContains('<div readability=', $readability->getContent()->getInnerHtml()); |
|
|
|
$this->assertStringContainsString('<div readability=', $readability->getContent()->getInnerHtml()); |
|
|
|
$this->assertEmpty($readability->getTitle()->getInnerHtml()); |
|
|
|
$this->assertEmpty($readability->getTitle()->getInnerHtml()); |
|
|
|
$this->assertContains('This is an awesome text with some links, here there are', $readability->getContent()->getInnerHtml()); |
|
|
|
$this->assertStringContainsString('This is an awesome text with some links, here there are', $readability->getContent()->getInnerHtml()); |
|
|
|
$this->assertContains('readabilityFootnoteLink', $readability->getContent()->getInnerHtml()); |
|
|
|
$this->assertStringContainsString('readabilityFootnoteLink', $readability->getContent()->getInnerHtml()); |
|
|
|
$this->assertContains('readabilityLink-3', $readability->getContent()->getInnerHtml()); |
|
|
|
$this->assertStringContainsString('readabilityLink-3', $readability->getContent()->getInnerHtml()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function testStandardClean() |
|
|
|
public function testStandardClean() |
|
|
|
@ -144,11 +144,11 @@ class ReadabilityTest extends \PHPUnit\Framework\TestCase |
|
|
|
$this->assertTrue($res); |
|
|
|
$this->assertTrue($res); |
|
|
|
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent()); |
|
|
|
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent()); |
|
|
|
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle()); |
|
|
|
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle()); |
|
|
|
$this->assertContains('<div readability=', $readability->getContent()->getInnerHtml()); |
|
|
|
$this->assertStringContainsString('<div readability=', $readability->getContent()->getInnerHtml()); |
|
|
|
$this->assertEmpty($readability->getTitle()->getInnerHtml()); |
|
|
|
$this->assertEmpty($readability->getTitle()->getInnerHtml()); |
|
|
|
$this->assertContains('This is an awesome text with some links, here there are', $readability->getContent()->getInnerHtml()); |
|
|
|
$this->assertStringContainsString('This is an awesome text with some links, here there are', $readability->getContent()->getInnerHtml()); |
|
|
|
$this->assertContains('will NOT be removed', $readability->getContent()->getInnerHtml()); |
|
|
|
$this->assertStringContainsString('will NOT be removed', $readability->getContent()->getInnerHtml()); |
|
|
|
$this->assertNotContains('<h2>', $readability->getContent()->getInnerHtml()); |
|
|
|
$this->assertStringNotContainsString('<h2>', $readability->getContent()->getInnerHtml()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function testWithIframe() |
|
|
|
public function testWithIframe() |
|
|
|
@ -160,10 +160,10 @@ class ReadabilityTest extends \PHPUnit\Framework\TestCase |
|
|
|
$this->assertTrue($res); |
|
|
|
$this->assertTrue($res); |
|
|
|
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent()); |
|
|
|
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent()); |
|
|
|
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle()); |
|
|
|
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle()); |
|
|
|
$this->assertContains('<div readability=', $readability->getContent()->getInnerHtml()); |
|
|
|
$this->assertStringContainsString('<div readability=', $readability->getContent()->getInnerHtml()); |
|
|
|
$this->assertEmpty($readability->getTitle()->getInnerHtml()); |
|
|
|
$this->assertEmpty($readability->getTitle()->getInnerHtml()); |
|
|
|
$this->assertContains('This is an awesome text with some links, here there are', $readability->getContent()->getInnerHtml()); |
|
|
|
$this->assertStringContainsString('This is an awesome text with some links, here there are', $readability->getContent()->getInnerHtml()); |
|
|
|
$this->assertContains('nofollow', $readability->getContent()->getInnerHtml()); |
|
|
|
$this->assertStringContainsString('nofollow', $readability->getContent()->getInnerHtml()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function testWithArticle() |
|
|
|
public function testWithArticle() |
|
|
|
@ -175,10 +175,10 @@ class ReadabilityTest extends \PHPUnit\Framework\TestCase |
|
|
|
$this->assertTrue($res); |
|
|
|
$this->assertTrue($res); |
|
|
|
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent()); |
|
|
|
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent()); |
|
|
|
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle()); |
|
|
|
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle()); |
|
|
|
$this->assertContains('alt="article"', $readability->getContent()->getInnerHtml()); |
|
|
|
$this->assertStringContainsString('alt="article"', $readability->getContent()->getInnerHtml()); |
|
|
|
$this->assertEmpty($readability->getTitle()->getInnerHtml()); |
|
|
|
$this->assertEmpty($readability->getTitle()->getInnerHtml()); |
|
|
|
$this->assertContains('This is an awesome text with some links, here there are', $readability->getContent()->getInnerHtml()); |
|
|
|
$this->assertStringContainsString('This is an awesome text with some links, here there are', $readability->getContent()->getInnerHtml()); |
|
|
|
$this->assertContains('nofollow', $readability->getContent()->getInnerHtml()); |
|
|
|
$this->assertStringContainsString('nofollow', $readability->getContent()->getInnerHtml()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function testWithAside() |
|
|
|
public function testWithAside() |
|
|
|
@ -191,9 +191,9 @@ class ReadabilityTest extends \PHPUnit\Framework\TestCase |
|
|
|
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent()); |
|
|
|
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent()); |
|
|
|
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle()); |
|
|
|
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle()); |
|
|
|
$this->assertEmpty($readability->getTitle()->getInnerHtml()); |
|
|
|
$this->assertEmpty($readability->getTitle()->getInnerHtml()); |
|
|
|
$this->assertContains('This is an awesome text with some links, here there are', $readability->getContent()->getInnerHtml()); |
|
|
|
$this->assertStringContainsString('This is an awesome text with some links, here there are', $readability->getContent()->getInnerHtml()); |
|
|
|
$this->assertNotContains('<aside>', $readability->getContent()->getInnerHtml()); |
|
|
|
$this->assertStringNotContainsString('<aside>', $readability->getContent()->getInnerHtml()); |
|
|
|
$this->assertContains('<footer readability="5"/>', $readability->getContent()->getInnerHtml()); |
|
|
|
$this->assertStringContainsString('<footer readability="5"/>', $readability->getContent()->getInnerHtml()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function testWithClasses() |
|
|
|
public function testWithClasses() |
|
|
|
@ -205,10 +205,10 @@ class ReadabilityTest extends \PHPUnit\Framework\TestCase |
|
|
|
$this->assertTrue($res); |
|
|
|
$this->assertTrue($res); |
|
|
|
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent()); |
|
|
|
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent()); |
|
|
|
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle()); |
|
|
|
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle()); |
|
|
|
$this->assertContains('alt="article"', $readability->getContent()->getInnerHtml()); |
|
|
|
$this->assertStringContainsString('alt="article"', $readability->getContent()->getInnerHtml()); |
|
|
|
$this->assertEmpty($readability->getTitle()->getInnerHtml()); |
|
|
|
$this->assertEmpty($readability->getTitle()->getInnerHtml()); |
|
|
|
$this->assertContains('This is an awesome text with some links, here there are', $readability->getContent()->getInnerHtml()); |
|
|
|
$this->assertStringContainsString('This is an awesome text with some links, here there are', $readability->getContent()->getInnerHtml()); |
|
|
|
$this->assertNotContains('This text should be removed', $readability->getContent()->getInnerHtml()); |
|
|
|
$this->assertStringNotContainsString('This text should be removed', $readability->getContent()->getInnerHtml()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function testWithClassesWithoutLightClean() |
|
|
|
public function testWithClassesWithoutLightClean() |
|
|
|
@ -221,10 +221,10 @@ class ReadabilityTest extends \PHPUnit\Framework\TestCase |
|
|
|
$this->assertTrue($res); |
|
|
|
$this->assertTrue($res); |
|
|
|
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent()); |
|
|
|
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent()); |
|
|
|
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle()); |
|
|
|
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle()); |
|
|
|
$this->assertContains('alt="article"', $readability->getContent()->getInnerHtml()); |
|
|
|
$this->assertStringContainsString('alt="article"', $readability->getContent()->getInnerHtml()); |
|
|
|
$this->assertEmpty($readability->getTitle()->getInnerHtml()); |
|
|
|
$this->assertEmpty($readability->getTitle()->getInnerHtml()); |
|
|
|
$this->assertContains('This is an awesome text with some links, here there are', $readability->getContent()->getInnerHtml()); |
|
|
|
$this->assertStringContainsString('This is an awesome text with some links, here there are', $readability->getContent()->getInnerHtml()); |
|
|
|
$this->assertNotContains('This text should be removed', $readability->getContent()->getInnerHtml()); |
|
|
|
$this->assertStringNotContainsString('This text should be removed', $readability->getContent()->getInnerHtml()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function testWithTd() |
|
|
|
public function testWithTd() |
|
|
|
@ -237,7 +237,7 @@ class ReadabilityTest extends \PHPUnit\Framework\TestCase |
|
|
|
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent()); |
|
|
|
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent()); |
|
|
|
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle()); |
|
|
|
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle()); |
|
|
|
$this->assertEmpty($readability->getTitle()->getInnerHtml()); |
|
|
|
$this->assertEmpty($readability->getTitle()->getInnerHtml()); |
|
|
|
$this->assertContains('This is an awesome text with some links, here there are', $readability->getContent()->getInnerHtml()); |
|
|
|
$this->assertStringContainsString('This is an awesome text with some links, here there are', $readability->getContent()->getInnerHtml()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function testWithSameClasses() |
|
|
|
public function testWithSameClasses() |
|
|
|
@ -250,8 +250,8 @@ class ReadabilityTest extends \PHPUnit\Framework\TestCase |
|
|
|
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent()); |
|
|
|
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent()); |
|
|
|
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle()); |
|
|
|
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle()); |
|
|
|
$this->assertEmpty($readability->getTitle()->getInnerHtml()); |
|
|
|
$this->assertEmpty($readability->getTitle()->getInnerHtml()); |
|
|
|
$this->assertContains('This is an awesome text with some links, here there are', $readability->getContent()->getInnerHtml()); |
|
|
|
$this->assertStringContainsString('This is an awesome text with some links, here there are', $readability->getContent()->getInnerHtml()); |
|
|
|
$this->assertContains('This text is also an awesome text and you should know that', $readability->getContent()->getInnerHtml()); |
|
|
|
$this->assertStringContainsString('This text is also an awesome text and you should know that', $readability->getContent()->getInnerHtml()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function testWithScript() |
|
|
|
public function testWithScript() |
|
|
|
@ -264,8 +264,8 @@ class ReadabilityTest extends \PHPUnit\Framework\TestCase |
|
|
|
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent()); |
|
|
|
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent()); |
|
|
|
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle()); |
|
|
|
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle()); |
|
|
|
$this->assertEmpty($readability->getTitle()->getInnerHtml()); |
|
|
|
$this->assertEmpty($readability->getTitle()->getInnerHtml()); |
|
|
|
$this->assertContains('This is an awesome text with some links, here there are', $readability->getContent()->getInnerHtml()); |
|
|
|
$this->assertStringContainsString('This is an awesome text with some links, here there are', $readability->getContent()->getInnerHtml()); |
|
|
|
$this->assertNotContains('This text is also an awesome text and you should know that', $readability->getContent()->getInnerHtml()); |
|
|
|
$this->assertStringNotContainsString('This text is also an awesome text and you should know that', $readability->getContent()->getInnerHtml()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function testTitle() |
|
|
|
public function testTitle() |
|
|
|
@ -278,8 +278,8 @@ class ReadabilityTest extends \PHPUnit\Framework\TestCase |
|
|
|
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent()); |
|
|
|
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent()); |
|
|
|
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle()); |
|
|
|
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle()); |
|
|
|
$this->assertEquals('this is my title', $readability->getTitle()->getInnerHtml()); |
|
|
|
$this->assertEquals('this is my title', $readability->getTitle()->getInnerHtml()); |
|
|
|
$this->assertContains('This is an awesome text with some links, here there are', $readability->getContent()->getInnerHtml()); |
|
|
|
$this->assertStringContainsString('This is an awesome text with some links, here there are', $readability->getContent()->getInnerHtml()); |
|
|
|
$this->assertNotContains('This text is also an awesome text and you should know that', $readability->getContent()->getInnerHtml()); |
|
|
|
$this->assertStringNotContainsString('This text is also an awesome text and you should know that', $readability->getContent()->getInnerHtml()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function testTitleWithDash() |
|
|
|
public function testTitleWithDash() |
|
|
|
@ -292,8 +292,8 @@ class ReadabilityTest extends \PHPUnit\Framework\TestCase |
|
|
|
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent()); |
|
|
|
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent()); |
|
|
|
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle()); |
|
|
|
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle()); |
|
|
|
$this->assertEquals('title2 - title3', $readability->getTitle()->getInnerHtml()); |
|
|
|
$this->assertEquals('title2 - title3', $readability->getTitle()->getInnerHtml()); |
|
|
|
$this->assertContains('This is an awesome text with some links, here there are', $readability->getContent()->getInnerHtml()); |
|
|
|
$this->assertStringContainsString('This is an awesome text with some links, here there are', $readability->getContent()->getInnerHtml()); |
|
|
|
$this->assertNotContains('This text is also an awesome text and you should know that', $readability->getContent()->getInnerHtml()); |
|
|
|
$this->assertStringNotContainsString('This text is also an awesome text and you should know that', $readability->getContent()->getInnerHtml()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function testTitleWithDoubleDot() |
|
|
|
public function testTitleWithDoubleDot() |
|
|
|
@ -306,8 +306,8 @@ class ReadabilityTest extends \PHPUnit\Framework\TestCase |
|
|
|
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent()); |
|
|
|
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent()); |
|
|
|
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle()); |
|
|
|
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle()); |
|
|
|
$this->assertEquals('title2 : title3', $readability->getTitle()->getInnerHtml()); |
|
|
|
$this->assertEquals('title2 : title3', $readability->getTitle()->getInnerHtml()); |
|
|
|
$this->assertContains('This is an awesome text with some links, here there are', $readability->getContent()->getInnerHtml()); |
|
|
|
$this->assertStringContainsString('This is an awesome text with some links, here there are', $readability->getContent()->getInnerHtml()); |
|
|
|
$this->assertNotContains('This text is also an awesome text and you should know that', $readability->getContent()->getInnerHtml()); |
|
|
|
$this->assertStringNotContainsString('This text is also an awesome text and you should know that', $readability->getContent()->getInnerHtml()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function testTitleTooShortUseH1() |
|
|
|
public function testTitleTooShortUseH1() |
|
|
|
@ -320,8 +320,8 @@ class ReadabilityTest extends \PHPUnit\Framework\TestCase |
|
|
|
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent()); |
|
|
|
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent()); |
|
|
|
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle()); |
|
|
|
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle()); |
|
|
|
$this->assertEquals('this is my h1 title !', $readability->getTitle()->getInnerHtml()); |
|
|
|
$this->assertEquals('this is my h1 title !', $readability->getTitle()->getInnerHtml()); |
|
|
|
$this->assertContains('This is an awesome text with some links, here there are', $readability->getContent()->getInnerHtml()); |
|
|
|
$this->assertStringContainsString('This is an awesome text with some links, here there are', $readability->getContent()->getInnerHtml()); |
|
|
|
$this->assertNotContains('This text is also an awesome text and you should know that', $readability->getContent()->getInnerHtml()); |
|
|
|
$this->assertStringNotContainsString('This text is also an awesome text and you should know that', $readability->getContent()->getInnerHtml()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// dummy function to be used to the next test |
|
|
|
// dummy function to be used to the next test |
|
|
|
@ -369,8 +369,8 @@ class ReadabilityTest extends \PHPUnit\Framework\TestCase |
|
|
|
$this->assertTrue($res); |
|
|
|
$this->assertTrue($res); |
|
|
|
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent()); |
|
|
|
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent()); |
|
|
|
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle()); |
|
|
|
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle()); |
|
|
|
$this->assertContains('<iframe src="https://www.youtube.com/embed/PUep6xNeKjA" width="560" height="315" frameborder="0" allowfullscreen="allowfullscreen"> </iframe>', $readability->getContent()->getInnerHtml()); |
|
|
|
$this->assertStringContainsString('<iframe src="https://www.youtube.com/embed/PUep6xNeKjA" width="560" height="315" frameborder="0" allowfullscreen="allowfullscreen"> </iframe>', $readability->getContent()->getInnerHtml()); |
|
|
|
$this->assertContains('3D Touch', $readability->getTitle()->getInnerHtml()); |
|
|
|
$this->assertStringContainsString('3D Touch', $readability->getTitle()->getInnerHtml()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
@ -440,7 +440,7 @@ class ReadabilityTest extends \PHPUnit\Framework\TestCase |
|
|
|
$res = $readability->init(); |
|
|
|
$res = $readability->init(); |
|
|
|
|
|
|
|
|
|
|
|
$this->assertTrue($res); |
|
|
|
$this->assertTrue($res); |
|
|
|
$this->assertContains('This the awesome content :)', $readability->getContent()->getInnerHtml()); |
|
|
|
$this->assertStringContainsString('This the awesome content :)', $readability->getContent()->getInnerHtml()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function testPreFilters() |
|
|
|
public function testPreFilters() |
|
|
|
@ -453,7 +453,7 @@ class ReadabilityTest extends \PHPUnit\Framework\TestCase |
|
|
|
$res = $readability->init(); |
|
|
|
$res = $readability->init(); |
|
|
|
|
|
|
|
|
|
|
|
$this->assertTrue($res); |
|
|
|
$this->assertTrue($res); |
|
|
|
$this->assertContains('This the awesome and WONDERFUL content :)', $readability->getContent()->getInnerHtml()); |
|
|
|
$this->assertStringContainsString('This the awesome and WONDERFUL content :)', $readability->getContent()->getInnerHtml()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function testChildNodeGoneNull() |
|
|
|
public function testChildNodeGoneNull() |
|
|
|
@ -479,8 +479,8 @@ class ReadabilityTest extends \PHPUnit\Framework\TestCase |
|
|
|
$res = $readability->init(); |
|
|
|
$res = $readability->init(); |
|
|
|
|
|
|
|
|
|
|
|
$this->assertTrue($res); |
|
|
|
$this->assertTrue($res); |
|
|
|
$this->assertContains('<sup id="fnref1:fnfeed_2"><a href="#fn:fnfeed_2" class="footnote-ref">2</a></sup>', $readability->getContent()->getInnerHtml()); |
|
|
|
$this->assertStringContainsString('<sup id="fnref1:fnfeed_2"><a href="#fn:fnfeed_2" class="footnote-ref">2</a></sup>', $readability->getContent()->getInnerHtml()); |
|
|
|
$this->assertContains('<a href="#fnref1:fnfeed_2" rev="footnote"', $readability->getContent()->getInnerHtml()); |
|
|
|
$this->assertStringContainsString('<a href="#fnref1:fnfeed_2" rev="footnote"', $readability->getContent()->getInnerHtml()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function testWithWipedBody() |
|
|
|
public function testWithWipedBody() |
|
|
|
@ -493,7 +493,7 @@ class ReadabilityTest extends \PHPUnit\Framework\TestCase |
|
|
|
$res = $readability->init(); |
|
|
|
$res = $readability->init(); |
|
|
|
|
|
|
|
|
|
|
|
$this->assertTrue($res); |
|
|
|
$this->assertTrue($res); |
|
|
|
$this->assertContains('<a href="alice-I.html">Down the Rabbit-Hole</a>', $readability->getContent()->getInnerHtml()); |
|
|
|
$this->assertStringContainsString('<a href="alice-I.html">Down the Rabbit-Hole</a>', $readability->getContent()->getInnerHtml()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private function getReadability($html, $url = null, $parser = 'libxml', $useTidy = true) |
|
|
|
private function getReadability($html, $url = null, $parser = 'libxml', $useTidy = true) |
|
|
|
|