Browse Source

add test to ensure a content property is not returned unless it is defined

pull/60/head
Aaron Parecki 6 years ago
parent
commit
44770396f9
No known key found for this signature in database GPG Key ID: 276C2817346D6056
2 changed files with 26 additions and 0 deletions
  1. +11
    -0
      tests/ParseTest.php
  2. +15
    -0
      tests/data/source.example.com/h-entry-no-content

+ 11
- 0
tests/ParseTest.php View File

@ -247,6 +247,17 @@ class ParseTest extends PHPUnit_Framework_TestCase {
$this->assertEquals('http://syndicated.example/', $data['data']['syndication'][0]); $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() { public function testHEntryIsNotFirstObject() {
$url = 'http://source.example.com/h-entry-is-not-first'; $url = 'http://source.example.com/h-entry-is-not-first';
$response = $this->parse(['url' => $url]); $response = $this->parse(['url' => $url]);

+ 15
- 0
tests/data/source.example.com/h-entry-no-content View File

@ -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
<html>
<head>
<title>Test</title>
</head>
<body class="h-entry">
<h2 class="p-name">This is a Post</h2>
<a href="h-entry-no-content" class="u-url">permalink</a>
</body>
</html>

Loading…
Cancel
Save