From 44770396f9d1d6f6f6dfb7c59959c62601a6467f Mon Sep 17 00:00:00 2001 From: Aaron Parecki Date: Fri, 12 Jan 2018 11:06:04 -0800 Subject: [PATCH] add test to ensure a content property is not returned unless it is defined --- tests/ParseTest.php | 11 +++++++++++ tests/data/source.example.com/h-entry-no-content | 15 +++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 tests/data/source.example.com/h-entry-no-content diff --git a/tests/ParseTest.php b/tests/ParseTest.php index ab01e38..fed9132 100644 --- a/tests/ParseTest.php +++ b/tests/ParseTest.php @@ -247,6 +247,17 @@ class ParseTest extends PHPUnit_Framework_TestCase { $this->assertEquals('http://syndicated.example/', $data['data']['syndication'][0]); } + public function testHEntryNoContent() { + $url = 'http://source.example.com/h-entry-no-content'; + $response = $this->parse(['url' => $url]); + + $body = $response->getContent(); + $this->assertEquals(200, $response->getStatusCode()); + $data = json_decode($body); + $this->assertObjectNotHasAttribute('content', $data->data); + $this->assertEquals('This is a Post', $data->data->name); + } + public function testHEntryIsNotFirstObject() { $url = 'http://source.example.com/h-entry-is-not-first'; $response = $this->parse(['url' => $url]); diff --git a/tests/data/source.example.com/h-entry-no-content b/tests/data/source.example.com/h-entry-no-content new file mode 100644 index 0000000..da52466 --- /dev/null +++ b/tests/data/source.example.com/h-entry-no-content @@ -0,0 +1,15 @@ +HTTP/1.1 200 OK +Server: Apache +Date: Wed, 09 Dec 2015 03:29:14 GMT +Content-Type: text/html; charset=utf-8 +Connection: keep-alive + + + + Test + + +

This is a Post

+ permalink + +