Repository navigation
Expand file tree
/
Copy pathOrganizationTest.php
More file actions
79 lines (64 loc) · 1.94 KB
/
Copy pathOrganizationTest.php
File metadata and controls
79 lines (64 loc) · 1.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?php
namespace Github\Tests\Api;
class OrganizationTest extends TestCase
{
/**
* @test
*/
public function shouldShowOrganization()
{
$expectedArray = array('id' => 1, 'name' => 'KnpLabs');
$api = $this->getApiMock();
$api->expects($this->once())
->method('get')
->with('orgs/KnpLabs')
->will($this->returnValue($expectedArray));
$this->assertEquals($expectedArray, $api->show('KnpLabs'));
}
/**
* @test
*/
public function shouldUpdateOrganization()
{
$expectedArray = array('id' => 1, 'name' => 'KnpLabs');
$api = $this->getApiMock();
$api->expects($this->once())
->method('patch')
->with('orgs/KnpLabs', array('value' => 'toUpdate'))
->will($this->returnValue($expectedArray));
$this->assertEquals($expectedArray, $api->update('KnpLabs', array('value' => 'toUpdate')));
}
/**
* @test
*/
public function shouldGetOrganizationRepositories()
{
$expectedArray = array(array('id' => 1, 'username' => 'KnpLabs', 'name' => 'php-github-api'));
$api = $this->getApiMock();
$api->expects($this->once())
->method('get')
->with('orgs/KnpLabs/repos', array('type' => 'all'))
->will($this->returnValue($expectedArray));
$this->assertEquals($expectedArray, $api->repositories('KnpLabs'));
}
/**
* @test
*/
public function shouldGetMembersApiObject()
{
$api = $this->getApiMock();
$this->assertInstanceOf('Github\Api\Organization\Members', $api->members());
}
/**
* @test
*/
public function shouldGetTeamsApiObject()
{
$api = $this->getApiMock();
$this->assertInstanceOf('Github\Api\Organization\Teams', $api->teams());
}
protected function getApiClass()
{
return 'Github\Api\Organization';
}
}