diff options
Diffstat (limited to 'test/HTMLParserTest.php')
-rw-r--r-- | test/HTMLParserTest.php | 10 |
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; |