summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/HTMLParserTest.php14
1 files changed, 10 insertions, 4 deletions
diff --git a/test/HTMLParserTest.php b/test/HTMLParserTest.php
index 4de7d7e..7ad4238 100644
--- a/test/HTMLParserTest.php
+++ b/test/HTMLParserTest.php
@@ -7,7 +7,10 @@ use andreskrey\Readability\HTMLParser;
class HTMLParserTest extends \PHPUnit_Framework_TestCase
{
- private function HTMLParserParsesHTML($html, $expectedResult, $expectedMetadata)
+ /**
+ * @dataProvider getSamplePages
+ */
+ public function testHTMLParserParsesHTML($html, $expectedResult)
{
$readability = new HTMLParser();
$result = $readability->parse($html);
@@ -15,17 +18,20 @@ class HTMLParserTest extends \PHPUnit_Framework_TestCase
$this->assertEquals($expectedResult, $result['html']);
}
- public function testSamplePages()
+ public function getSamplePages()
{
$path = pathinfo(__FILE__, PATHINFO_DIRNAME) . DIRECTORY_SEPARATOR . 'test-pages';
$testPages = scandir($path);
+ $pages = [];
+
foreach(array_slice($testPages, 2) as $testPage){
$source = file_get_contents($path . DIRECTORY_SEPARATOR . $testPage . DIRECTORY_SEPARATOR . 'source.html');
- $expectedMetadata = file_get_contents($path . DIRECTORY_SEPARATOR . $testPage . DIRECTORY_SEPARATOR . 'expected-metadata.json');
$expectedHTML = file_get_contents($path . DIRECTORY_SEPARATOR . $testPage . DIRECTORY_SEPARATOR . 'expected.html');
- $this->HTMLParserParsesHTML($source, $expectedHTML, $expectedMetadata);
+ $pages[] = [$source, $expectedHTML];
}
+
+ return $pages;
}
} \ No newline at end of file