summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAndres Rey <[email protected]>2016-12-23 11:30:32 -0300
committerAndres Rey <[email protected]>2016-12-23 11:30:32 -0300
commit26dc6f0ec290d2e5a499372ab0abd5fdbbf57448 (patch)
treecce7959642fefdb76428fbb8a9d4923e7cc6ceca /test
parentb4bd54c469c9d9e24adbfadec50932fb319230a7 (diff)
Updated the fake url for the test case and corrected more expected htmls
Diffstat (limited to 'test')
-rw-r--r--test/HTMLParserTest.php4
-rw-r--r--test/test-pages/001/expected.html6
-rw-r--r--test/test-pages/base-url/expected.html36
-rw-r--r--test/test-pages/buzzfeed-1/expected.html2
4 files changed, 25 insertions, 23 deletions
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 @@
-<section><p><strong>So finally you're <a href="/code/2013/testing-frontend-javascript-code-using-mocha-chai-and-sinon/">testing your frontend JavaScript code</a>? Great! The more you
+<section><p><strong>So finally you're <a href="http://fakehost/code/2013/testing-frontend-javascript-code-using-mocha-chai-and-sinon/">testing your frontend JavaScript code</a>? Great! The more you
write tests, the more confident you are with your code… but how much precisely?
That's where <a href="http://en.wikipedia.org/wiki/Code_coverage">code coverage</a> might
help.</strong>
@@ -34,7 +34,7 @@ with nodejs.</em>
<a href="https://raw.github.com/alex-seville/blanket/master/src/adapters/mocha-blanket.js">mocha-blanket.js</a>
</p>
<p>As an example, let's reuse the silly <code>Cow</code> example we used
- <a href="/code/2013/testing-frontend-javascript-code-using-mocha-chai-and-sinon/">in a previous episode</a>:</p>
+ <a href="http://fakehost/code/2013/testing-frontend-javascript-code-using-mocha-chai-and-sinon/">in a previous episode</a>:</p>
<pre><code>// cow.js
(function(exports) {
"use strict";
@@ -111,7 +111,7 @@ describe("Cow", function() {
be loaded.</li>
</ul><p>Running the tests now gives us something like this:</p>
<p>
- <img alt="screenshot" src="/static/code/2013/blanket-coverage.png"></img></p>
+ <img alt="screenshot" src="http://fakehost/static/code/2013/blanket-coverage.png"></img></p>
<p>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 @@
<article>
<p>
- 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.
</p>
<p>Links</p>
<p><a href="http://fakehost/test/foo/bar/baz.html">link</a></p>
@@ -17,17 +17,17 @@
<p><a href="http://test/foo/bar/baz.html">link</a></p>
<p><a href="https://test/foo/bar/baz.html">link</a></p>
<p>Images</p>
- <p><img src="http://fakehost/test/foo/bar/baz.png"/></p>
- <p><img src="http://fakehost/test/foo/bar/baz.png"/></p>
- <p><img src="http://fakehost/foo/bar/baz.png"/></p>
- <p><img src="http://test/foo/bar/baz.png"/></p>
- <p><img src="https://test/foo/bar/baz.png"/></p>
-
+ <p><img src="http://fakehost/test/foo/bar/baz.png"></img></p>
+ <p><img src="http://fakehost/test/foo/bar/baz.png"></img></p>
+ <p><img src="http://fakehost/foo/bar/baz.png"></img></p>
+ <p><img src="http://test/foo/bar/baz.png"></img></p>
+ <p><img src="https://test/foo/bar/baz.png"></img></p>
+
<p>
- 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.
</p>
-</article> \ No newline at end of file
+ </article> \ 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 @@
</div>
<div class="buzz_superlist_item buzz_superlist_item_text buzz_superlist_item_wide " id="superlist_3758406_5547219" rel:buzz_num="5">
<h2>Fiona Parry issued a plea for people to stay away from pills containing the chemical.</h2>
- <br></br><p class="sub_buzz_desc">“[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.</p>
+ <p class="sub_buzz_desc">“[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.</p>
<p>“DNP is not a miracle slimming pill. It is a deadly toxin.”</p>
</div>
</div> \ No newline at end of file