diff options
author | Andres Rey <[email protected]> | 2018-03-14 15:28:27 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2018-03-14 15:28:27 +0000 |
commit | 651d961fb58f6935a2a5bbb31b25c563017fae14 (patch) | |
tree | 108c94b82a971273a5ee17e6bb1c8aa11579fb50 | |
parent | f0f69065301d640ccf7308cff7c1eb006d03ef45 (diff) | |
parent | c9ea925acd0ba9a91c9126c851943356934616a7 (diff) |
Merge pull request #49 from PedroAmorim/fixC14N
Fix error C14N
-rw-r--r-- | src/Readability.php | 2 | ||||
-rw-r--r-- | test/ReadabilityTest.php | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/src/Readability.php b/src/Readability.php index 91e703c..111c31e 100644 --- a/src/Readability.php +++ b/src/Readability.php @@ -1564,7 +1564,7 @@ class Readability */ public function getContent() { - return $this->content->C14N(); + return ($this->content instanceof DOMDocument) ? $this->content->C14N() : null; } /** diff --git a/test/ReadabilityTest.php b/test/ReadabilityTest.php index fe17b23..95293d9 100644 --- a/test/ReadabilityTest.php +++ b/test/ReadabilityTest.php @@ -117,4 +117,10 @@ class ReadabilityTest extends \PHPUnit_Framework_TestCase $this->expectExceptionMessage('Could not parse text.'); $parser->parse('<html><body><p>hello</p></body></html>'); } + + public function testReadabilityCallGetContentWithNoContent() + { + $parser = new Readability(new Configuration()); + $this->assertNull($parser->getContent()); + } } |