summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro Amorim <[email protected]>2017-11-22 10:50:09 +0100
committerPedro Amorim <[email protected]>2017-11-23 10:55:52 +0100
commite33dd203ca16c1827e6e2b25b7961dcbd77f3cb2 (patch)
tree961416d8724f260d557441a29b62d8ae7b649008
parent99db71502dd7221bd251785dba68a8fe93fdcb39 (diff)
Add test testHTMLParserParsesImages()
-rw-r--r--test/HTMLParserTest.php18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/HTMLParserTest.php b/test/HTMLParserTest.php
index 96c07df..2aafa65 100644
--- a/test/HTMLParserTest.php
+++ b/test/HTMLParserTest.php
@@ -24,6 +24,24 @@ class HTMLParserTest extends \PHPUnit_Framework_TestCase
$result = $readability->parse($html);
$this->assertEquals($expectedResult, $result['html']);
+ }
+
+ /**
+ * @dataProvider getSamplePages
+ */
+ public function testHTMLParserParsesImages($html, $expectedResult, $expectedMetadata, $config, $expectedImages)
+ {
+ $options = ['originalURL' => 'http://fakehost/test/test.html',
+ 'fixRelativeURLs' => true,
+ 'substituteEntities' => true,
+ ];
+
+ if ($config) {
+ $options = array_merge($options, $config);
+ }
+
+ $readability = new HTMLParser($options);
+ $result = $readability->parse($html);
$this->assertEquals($expectedImages, json_encode($result['images']));
}