From 88a2c7f5bf0955dd8d70c637ffabf5bc92be13ea Mon Sep 17 00:00:00 2001 From: Aaron Parecki Date: Sat, 21 Jan 2017 11:45:31 -0800 Subject: [PATCH] add test for syndication property --- tests/ParseTest.php | 12 ++++++++++++ tests/data/source.example.com/has-syndication | 15 +++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 tests/data/source.example.com/has-syndication diff --git a/tests/ParseTest.php b/tests/ParseTest.php index 8dead17..de96563 100644 --- a/tests/ParseTest.php +++ b/tests/ParseTest.php @@ -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]); diff --git a/tests/data/source.example.com/has-syndication b/tests/data/source.example.com/has-syndication new file mode 100644 index 0000000..2e51851 --- /dev/null +++ b/tests/data/source.example.com/has-syndication @@ -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 page has links to target.example.com and target2.example.com.

+ syndicated post + +