From 26dc6f0ec290d2e5a499372ab0abd5fdbbf57448 Mon Sep 17 00:00:00 2001 From: Andres Rey Date: Fri, 23 Dec 2016 11:30:32 -0300 Subject: Updated the fake url for the test case and corrected more expected htmls --- test/HTMLParserTest.php | 4 +++- test/test-pages/001/expected.html | 6 +++--- test/test-pages/base-url/expected.html | 36 ++++++++++++++++---------------- test/test-pages/buzzfeed-1/expected.html | 2 +- 4 files changed, 25 insertions(+), 23 deletions(-) (limited to 'test') diff --git a/test/HTMLParserTest.php b/test/HTMLParserTest.php index 1e64fdc..5e58135 100644 --- a/test/HTMLParserTest.php +++ b/test/HTMLParserTest.php @@ -11,7 +11,9 @@ class HTMLParserTest extends \PHPUnit_Framework_TestCase */ public function testHTMLParserParsesHTML($html, $expectedResult, $expectedMetadata) { - $readability = new HTMLParser(); + $readability = new HTMLParser([ + 'originalURL' => 'http://fakehost/test/test.html' + ]); $result = $readability->parse($html); $this->assertEquals($expectedResult, $result['html']); diff --git a/test/test-pages/001/expected.html b/test/test-pages/001/expected.html index bf3075c..c101aec 100644 --- a/test/test-pages/001/expected.html +++ b/test/test-pages/001/expected.html @@ -1,4 +1,4 @@ -

So finally you're testing your frontend JavaScript code? Great! The more you +

So finally you're testing your frontend JavaScript code? Great! The more you write tests, the more confident you are with your code… but how much precisely? That's where code coverage might help. @@ -34,7 +34,7 @@ with nodejs. mocha-blanket.js

As an example, let's reuse the silly Cow example we used - in a previous episode:

+ in a previous episode:

// cow.js
 (function(exports) {
   "use strict";
@@ -111,7 +111,7 @@ describe("Cow", function() {
                                 be loaded.
                         

Running the tests now gives us something like this:

- screenshot

+ screenshot

As you can see, the report at the bottom highlights that we haven't actually tested the case where an error is raised in case a target name is missing. We've been informed of that, nothing more, nothing less. We simply know diff --git a/test/test-pages/base-url/expected.html b/test/test-pages/base-url/expected.html index ee61616..dcdd7cf 100644 --- a/test/test-pages/base-url/expected.html +++ b/test/test-pages/base-url/expected.html @@ -1,11 +1,11 @@

- Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod - tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, - quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo - consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse - cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non - proident, sunt in culpa qui officia deserunt mollit anim id est laborum. + Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod + tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, + quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo + consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse + cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non + proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Links

link

@@ -17,17 +17,17 @@

link

link

Images

-

-

-

-

-

- +

+

+

+

+

+

- Tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, - quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo - consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse - cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non - proident, sunt in culpa qui officia deserunt mollit anim id est laborum. + Tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, + quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo + consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse + cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non + proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

-
\ No newline at end of file + \ No newline at end of file diff --git a/test/test-pages/buzzfeed-1/expected.html b/test/test-pages/buzzfeed-1/expected.html index 3601ef4..3e477ae 100644 --- a/test/test-pages/buzzfeed-1/expected.html +++ b/test/test-pages/buzzfeed-1/expected.html @@ -36,7 +36,7 @@

Fiona Parry issued a plea for people to stay away from pills containing the chemical.

-

“[Eloise] just never really understood how dangerous the tablets that she took were,” she said. “Most of us don’t believe that a slimming tablet could possibly kill us.

+

“[Eloise] just never really understood how dangerous the tablets that she took were,” she said. “Most of us don’t believe that a slimming tablet could possibly kill us.

“DNP is not a miracle slimming pill. It is a deadly toxin.”

\ No newline at end of file -- cgit v1.2.3