diff options
Diffstat (limited to 'test/HTMLParserTest.php')
-rw-r--r-- | test/HTMLParserTest.php | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/test/HTMLParserTest.php b/test/HTMLParserTest.php index ad6d943..96c07df 100644 --- a/test/HTMLParserTest.php +++ b/test/HTMLParserTest.php @@ -9,7 +9,7 @@ class HTMLParserTest extends \PHPUnit_Framework_TestCase /** * @dataProvider getSamplePages */ - public function testHTMLParserParsesHTML($html, $expectedResult, $expectedMetadata, $config) + public function testHTMLParserParsesHTML($html, $expectedResult, $expectedMetadata, $config, $expectedImages) { $options = ['originalURL' => 'http://fakehost/test/test.html', 'fixRelativeURLs' => true, @@ -24,6 +24,7 @@ class HTMLParserTest extends \PHPUnit_Framework_TestCase $result = $readability->parse($html); $this->assertEquals($expectedResult, $result['html']); + $this->assertEquals($expectedImages, json_encode($result['images'])); } public function getSamplePages() @@ -40,6 +41,7 @@ class HTMLParserTest extends \PHPUnit_Framework_TestCase $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'); + $expectedImages = file_get_contents($path . DIRECTORY_SEPARATOR . $testPage . DIRECTORY_SEPARATOR . 'expected-images.json'); $config = null; if (file_exists($path . DIRECTORY_SEPARATOR . $testPage . DIRECTORY_SEPARATOR . 'config.json')) { @@ -49,7 +51,7 @@ class HTMLParserTest extends \PHPUnit_Framework_TestCase } } - $pages[$testPage] = [$source, $expectedHTML, $expectedMetadata, $config]; + $pages[$testPage] = [$source, $expectedHTML, $expectedMetadata, $config, $expectedImages]; } return $pages; |