Skip to content

Commit 0d8529f

Browse files
author
Skaelv
committed
add update companies specs
1 parent 77b4509 commit 0d8529f

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@ $client->users->create([
7171
]
7272
]);
7373

74-
// Find a single user by email
74+
// Find a single user by email
7575
$client->users->getUsers(["email" => "[email protected]"]);
7676

77-
// List all users
77+
// List all users
7878
$client->users->getUsers([]);
7979
```
8080

@@ -152,6 +152,11 @@ $client->companies->create([
152152
"name" => "foocorp", "id" => "3"
153153
]);
154154

155+
// Update a company (Note: This method is an alias to the create method. In practice you can use create to update companies if you wish)
156+
$client->companies->update([
157+
"name" => "foocorp", "id" => "3"
158+
]);
159+
155160
// List Companies
156161
$client->companies->getCompanies([]);
157162
```

test/IntercomCompaniesTest.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
use GuzzleHttp\Middleware;
1010

1111
class IntercomCompaniesTest extends PHPUnit_Framework_TestCase {
12-
public function testUserCreate()
12+
public function testCompanyCreate()
1313
{
1414
$stub = $this->getMockBuilder('Intercom\IntercomClient')->disableOriginalConstructor()->getMock();
1515
$stub->method('post')->willReturn('foo');
@@ -18,7 +18,16 @@ public function testUserCreate()
1818
$this->assertEquals('foo', $companies->create([]));
1919
}
2020

21-
public function testUserGet()
21+
public function testCompanyUpdate()
22+
{
23+
$stub = $this->getMockBuilder('Intercom\IntercomClient')->disableOriginalConstructor()->getMock();
24+
$stub->method('post')->willReturn('foo');
25+
26+
$companies = new IntercomCompanies($stub);
27+
$this->assertEquals('foo', $companies->update([]));
28+
}
29+
30+
public function testCompanyGet()
2231
{
2332
$stub = $this->getMockBuilder('Intercom\IntercomClient')->disableOriginalConstructor()->getMock();
2433
$stub->method('get')->willReturn('foo');

0 commit comments

Comments
 (0)