summaryrefslogtreecommitdiff
path: root/test/HTMLParserTest.php
diff options
context:
space:
mode:
authorAndres Rey <[email protected]>2016-12-08 15:45:39 +0000
committerAndres Rey <[email protected]>2016-12-08 15:45:39 +0000
commit1e0cc1cda41d1e9bd223dfba616c4b1351b6934e (patch)
treecb20a027e2348a72224b0dcaecf530d9397f00da /test/HTMLParserTest.php
parent2b5e1f66f0ceb8b00e1c29dc9e3cb18ce3554bbd (diff)
Added option to remove the data-readability tags.
Diffstat (limited to 'test/HTMLParserTest.php')
-rw-r--r--test/HTMLParserTest.php10
1 files changed, 7 insertions, 3 deletions
diff --git a/test/HTMLParserTest.php b/test/HTMLParserTest.php
index 7ad4238..6d46a90 100644
--- a/test/HTMLParserTest.php
+++ b/test/HTMLParserTest.php
@@ -10,7 +10,7 @@ class HTMLParserTest extends \PHPUnit_Framework_TestCase
/**
* @dataProvider getSamplePages
*/
- public function testHTMLParserParsesHTML($html, $expectedResult)
+ public function testHTMLParserParsesHTML($html, $expectedResult, $expectedMetadata)
{
$readability = new HTMLParser();
$result = $readability->parse($html);
@@ -22,14 +22,18 @@ class HTMLParserTest extends \PHPUnit_Framework_TestCase
{
$path = pathinfo(__FILE__, PATHINFO_DIRNAME) . DIRECTORY_SEPARATOR . 'test-pages';
$testPages = scandir($path);
+ if (in_array('.DS_Store', $testPages)) {
+ unset($testPages[array_search('.DS_Store', $testPages)]);
+ }
$pages = [];
- foreach(array_slice($testPages, 2) as $testPage){
+ foreach (array_slice($testPages, 2) as $testPage) {
$source = file_get_contents($path . DIRECTORY_SEPARATOR . $testPage . DIRECTORY_SEPARATOR . 'source.html');
$expectedHTML = file_get_contents($path . DIRECTORY_SEPARATOR . $testPage . DIRECTORY_SEPARATOR . 'expected.html');
+ $expectedMetadata = file_get_contents($path . DIRECTORY_SEPARATOR . $testPage . DIRECTORY_SEPARATOR . 'expected-metadata.json');
- $pages[] = [$source, $expectedHTML];
+ $pages[] = [$source, $expectedHTML, $expectedMetadata];
}
return $pages;