Repository navigation
Expand file tree
/
Copy pathForksTest.php
More file actions
62 lines (50 loc) · 1.67 KB
/
Copy pathForksTest.php
File metadata and controls
62 lines (50 loc) · 1.67 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
<?php
namespace Github\Tests\Api\Repository;
use Github\Tests\Api\TestCase;
class ForksTest extends TestCase
{
/**
* @test
*/
public function shouldGetForks()
{
$expectedValue = array(array('name' => 'l3l0repo'));
$api = $this->getApiMock();
$api->expects($this->once())
->method('get')
->with('repos/KnpLabs/php-github-api/forks', array('page' => 1))
->will($this->returnValue($expectedValue));
$this->assertEquals($expectedValue, $api->all('KnpLabs', 'php-github-api'));
}
/**
* @test
*/
public function shouldCreateFork()
{
$expectedValue = array(array('name' => 'l3l0repo'));
$data = array('someparam');
$api = $this->getApiMock();
$api->expects($this->once())
->method('post')
->with('repos/KnpLabs/php-github-api/forks', $data)
->will($this->returnValue($expectedValue));
$this->assertEquals($expectedValue, $api->create('KnpLabs', 'php-github-api', $data));
}
/**
* @test
*/
public function shouldSortByNewestWhenSortParamNotRecognized()
{
$expectedValue = array(array('name' => 'l3l0repo'));
$api = $this->getApiMock();
$api->expects($this->once())
->method('get')
->with('repos/KnpLabs/php-github-api/forks', array('page' => 1, 'sort' => 'newest'))
->will($this->returnValue($expectedValue));
$this->assertEquals($expectedValue, $api->all('KnpLabs', 'php-github-api', array('sort' => 'oldes')));
}
protected function getApiClass()
{
return 'Github\Api\Repository\Forks';
}
}