From 3edc01d1b7a70c69b42da2681097e41e7d8bab73 Mon Sep 17 00:00:00 2001 From: Aaron Parecki Date: Sat, 5 Mar 2016 10:33:08 -0800 Subject: [PATCH] add test for invitee --- tests/ParseTest.php | 16 +++++++ tests/data/source.example.com/bridgy-invitee | 48 ++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 tests/data/source.example.com/bridgy-invitee diff --git a/tests/ParseTest.php b/tests/ParseTest.php index 2725d2c..362f03b 100644 --- a/tests/ParseTest.php +++ b/tests/ParseTest.php @@ -9,6 +9,7 @@ class ParseTest extends PHPUnit_Framework_TestCase { public function setUp() { $this->client = new Parse(); $this->client->http = new p3k\HTTPTest(dirname(__FILE__).'/data/'); + $this->client->mc = null; } private function parse($params) { @@ -309,4 +310,19 @@ class ParseTest extends PHPUnit_Framework_TestCase { $this->assertEquals('Venue', $data['refs']['http://source.example.com/venue']['name']); } + public function testEntryIsAnInvitee() { + $url = 'http://source.example.com/bridgy-invitee'; + $response = $this->parse(['url' => $url]); + + $body = $response->getContent(); + $this->assertEquals(200, $response->getStatusCode()); + $data = json_decode($body, true); + + $this->assertEquals('entry', $data['data']['type']); + $this->assertEquals('https://www.facebook.com/555707837940351#tantek', $data['data']['url']); + $this->assertContains('https://www.facebook.com/tantek.celik', $data['data']['invitee']); + $this->assertArrayHasKey('https://www.facebook.com/tantek.celik', $data['refs']); + $this->assertEquals('Tantek Çelik', $data['refs']['https://www.facebook.com/tantek.celik']['name']); + } + } diff --git a/tests/data/source.example.com/bridgy-invitee b/tests/data/source.example.com/bridgy-invitee new file mode 100644 index 0000000..3936d9b --- /dev/null +++ b/tests/data/source.example.com/bridgy-invitee @@ -0,0 +1,48 @@ +HTTP/1.1 200 OK +Server: Apache +Date: Wed, 02 Dec 2015 03:30:14 GMT +Content-Type: text/html; charset=utf-8 +Connection: keep-alive + + + + + +Bridgy Response + + +
+ tag:facebook.com,2013:555707837940351_rsvp_10153997868474283 + + invited + +
+ + Tantek Çelik + + +
+ + + + + + +
+ + \ No newline at end of file