Browse Source

add test for syndication property

pull/39/head
Aaron Parecki 4 years ago
parent
commit
88a2c7f5bf
No known key found for this signature in database GPG Key ID: 276C2817346D6056
2 changed files with 27 additions and 0 deletions
  1. +12
    -0
      tests/ParseTest.php
  2. +15
    -0
      tests/data/source.example.com/has-syndication

+ 12
- 0
tests/ParseTest.php View File

@ -214,6 +214,18 @@ class ParseTest extends PHPUnit_Framework_TestCase {
$this->assertEquals('Alice', $data['refs']['http://alice.example.com/']['name']);
}
public function testSyndicationIsURL() {
$url = 'http://source.example.com/has-syndication';
$response = $this->parse(['url' => $url]);
$body = $response->getContent();
$this->assertEquals(200, $response->getStatusCode());
$data = json_decode($body, true);
$this->assertEquals('entry', $data['data']['type']);
print_r($data['data']);
$this->assertEquals('http://syndicated.example/', $data['data']['syndication'][0]);
}
public function testHEntryIsNotFirstObject() {
$url = 'http://source.example.com/h-entry-is-not-first';
$response = $this->parse(['url' => $url]);

+ 15
- 0
tests/data/source.example.com/has-syndication 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">
<p class="e-content">This page has links to <a href="http://target.example.com">target.example.com</a> and <a href="http://target2.example.com">target2.example.com</a>.</p>
<a href="http://syndicated.example/" class="u-syndication">syndicated post</a>
</body>
</html>

Loading…
Cancel
Save