Skip to content

Commit f233deb

Browse files
committed
Merge pull request #31 from intercom/add_admin_tests
Add Admin tests
2 parents 6204af7 + 18ab6c8 commit f233deb

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
namespace Intercom;
4+
5+
class AdminTest extends IntercomTestCase
6+
{
7+
public function testGetAdmins()
8+
{
9+
$this->setMockResponse($this->client, 'Admin/AdminList.txt');
10+
$response = $this->client->getAdmins();
11+
$admins = $response->get('admins');
12+
13+
$this->assertRequest('GET', '/admins');
14+
15+
$this->assertInstanceOf('\Guzzle\Service\Resource\Model', $response);
16+
$this->assertEquals(2, count($admins));
17+
$this->assertEquals('Hoban Washburne', $admins['0']['name']);
18+
$this->assertEquals('Zoe Alleyne', $admins['1']['name']);
19+
}
20+
}

tests/Mock/Admin/AdminList.txt

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
HTTP/1.1 200 OK
2+
Cache-Control: max-age=0, private, must-revalidate
3+
Content-Type: application/json; charset=utf-8
4+
Date: Mon, 25 Aug 2014 23:57:54 GMT
5+
Server: nginx
6+
7+
{
8+
"type": "admin.list",
9+
"admins": [
10+
{
11+
"type": "admin",
12+
"id": "1",
13+
"name": "Hoban Washburne",
14+
"email": "[email protected]"
15+
},
16+
{
17+
"type": "admin",
18+
"id": "2",
19+
"name": "Zoe Alleyne",
20+
"email": "[email protected]"
21+
}
22+
]
23+
}

0 commit comments

Comments
 (0)