From 1e0cc1cda41d1e9bd223dfba616c4b1351b6934e Mon Sep 17 00:00:00 2001 From: Andres Rey Date: Thu, 8 Dec 2016 15:45:39 +0000 Subject: Added option to remove the data-readability tags. --- test/HTMLParserTest.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'test/HTMLParserTest.php') 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; -- cgit v1.2.3