Skip to content

Commit 65e9828

Browse files
committed
Fix CS and add test for latest merge
1 parent 0df9f48 commit 65e9828

File tree

4 files changed

+27
-10
lines changed

4 files changed

+27
-10
lines changed

lib/Github/Api/Repo.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,17 @@ public function show($username, $repository)
5555
* Create repository
5656
* @link http://developer.github.com/v3/repos/
5757
*
58-
* @param string $name name of the repository
59-
* @param string $description repository description
60-
* @param string $homepage homepage url
61-
* @param boolean $public 1 for public, 0 for private
62-
* @param boolean|string $organization username of organization if applicable
58+
* @param string $name name of the repository
59+
* @param string $description repository description
60+
* @param string $homepage homepage url
61+
* @param boolean $public `true` for public, `false` for private
62+
* @param null|string $organization username of organization if applicable
6363
*
6464
* @return array returns repository data
6565
*/
66-
public function create($name, $description = '', $homepage = '', $public = true, $organization = false)
66+
public function create($name, $description = '', $homepage = '', $public = true, $organization = null)
6767
{
68-
$path = ($organization) ? 'orgs/'.$organization.'/repos' : 'user/repos';
68+
$path = null !== $organization ? 'orgs/'.$organization.'/repos' : 'user/repos';
6969

7070
return $this->post($path, array(
7171
'name' => $name,

lib/Github/HttpClient/HttpClient.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,9 @@ public function delete($path, array $parameters = array(), array $headers = arra
131131
/**
132132
* {@inheritDoc}
133133
*/
134-
public function put($path, array $paramters = array(), array $headers = array())
134+
public function put($path, array $parameters = array(), array $headers = array())
135135
{
136-
return $this->request($path, $paramters, 'PUT', $headers);
136+
return $this->request($path, $parameters, 'PUT', $headers);
137137
}
138138

139139
/**

lib/Github/HttpClient/HttpClientInterface.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,12 @@ public function patch($path, array $parameters = array(), array $headers = array
4848
* Send a PUT request
4949
*
5050
* @param string $path Request path
51+
* @param array $parameters PUT Parameters
5152
* @param array $headers Reconfigure the request headers for this call only
5253
*
5354
* @return array Data
5455
*/
55-
public function put($path, array $paramters = array(), array $headers = array());
56+
public function put($path, array $parameters = array(), array $headers = array());
5657

5758
/**
5859
* Send a DELETE request

test/Github/Tests/Api/RepoTest.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,22 @@ public function shouldCreateRepositoryUsingNameOnly()
7979
$this->assertEquals($expectedArray, $api->create('l3l0Repo'));
8080
}
8181

82+
/**
83+
* @test
84+
*/
85+
public function shouldCreateRepositoryForOrganization()
86+
{
87+
$expectedArray = array('id' => 1, 'name' => 'KnpLabsRepo');
88+
89+
$api = $this->getApiMock();
90+
$api->expects($this->once())
91+
->method('post')
92+
->with('orgs/KnpLabs/repos', array('name' => 'KnpLabsRepo', 'description' => '', 'homepage' => '', 'private' => false))
93+
->will($this->returnValue($expectedArray));
94+
95+
$this->assertEquals($expectedArray, $api->create('KnpLabsRepo', '', '', true, 'KnpLabs'));
96+
}
97+
8298
/**
8399
* @test
84100
*/

0 commit comments

Comments
 (0)