Skip to content

Commit 2f94518

Browse files
committed
Adjust test to latest code changes
1 parent ac8ea59 commit 2f94518

File tree

1 file changed

+17
-32
lines changed

1 file changed

+17
-32
lines changed

test/Github/Tests/Api/Repository/CommentsTest.php

Lines changed: 17 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function shouldShowComment()
6565
*/
6666
public function shouldNotCreateWithoutBody()
6767
{
68-
$data = array('commit_id' => 123, 'line' => 53, 'path' => 'test.php', 'position' => 2);
68+
$data = array('line' => 53, 'path' => 'test.php', 'position' => 2);
6969

7070
$api = $this->getApiMock();
7171
$api->expects($this->never())
@@ -78,24 +78,9 @@ public function shouldNotCreateWithoutBody()
7878
* @test
7979
* @expectedException Github\Exception\MissingArgumentException
8080
*/
81-
public function shouldNotCreateWithoutCommitId()
82-
{
83-
$data = array('body' => 'body', 'line' => 53, 'path' => 'test.php', 'position' => 2);
84-
85-
$api = $this->getApiMock();
86-
$api->expects($this->never())
87-
->method('post');
88-
89-
$api->create('KnpLabs', 'php-github-api', 'commitSHA123456', $data);
90-
}
91-
92-
/**
93-
* @test
94-
* @expectedException Github\Exception\MissingArgumentException
95-
*/
96-
public function shouldNotCreateWithoutLine()
81+
public function shouldNotCreateWithoutPath()
9782
{
98-
$data = array('body' => 'body', 'commit_id' => 123, 'path' => 'test.php', 'position' => 2);
83+
$data = array('body' => 'body', 'line' => 11, 'position' => 2);
9984

10085
$api = $this->getApiMock();
10186
$api->expects($this->never())
@@ -108,9 +93,9 @@ public function shouldNotCreateWithoutLine()
10893
* @test
10994
* @expectedException Github\Exception\MissingArgumentException
11095
*/
111-
public function shouldNotCreateWithoutPath()
96+
public function shouldNotCreateWithoutPosition()
11297
{
113-
$data = array('body' => 'body', 'commit_id' => 123, 'line' => 11, 'position' => 2);
98+
$data = array('body' => 'body', 'path' => 'test.php', 'line' => 2);
11499

115100
$api = $this->getApiMock();
116101
$api->expects($this->never())
@@ -121,34 +106,36 @@ public function shouldNotCreateWithoutPath()
121106

122107
/**
123108
* @test
124-
* @expectedException Github\Exception\MissingArgumentException
125109
*/
126-
public function shouldNotCreateWithoutPosition()
110+
public function shouldCreateRepositoryCommitComment()
127111
{
128-
$data = array('body' => 'body', 'commit_id' => 123, 'path' => 'test.php', 'line' => 2);
112+
$expectedValue = array('comment1data');
113+
$data = array('body' => 'test body', 'line' => 53, 'path' => 'test.php', 'position' => 2);
129114

130115
$api = $this->getApiMock();
131-
$api->expects($this->never())
132-
->method('post');
116+
$api->expects($this->once())
117+
->method('post')
118+
->with('repos/KnpLabs/php-github-api/commits/commitSHA123456/comments', $data)
119+
->will($this->returnValue($expectedValue));
133120

134-
$api->create('KnpLabs', 'php-github-api', 'commitSHA123456', $data);
121+
$this->assertEquals($expectedValue, $api->create('KnpLabs', 'php-github-api', 'commitSHA123456', $data));
135122
}
136123

137124
/**
138125
* @test
139126
*/
140-
public function shouldCreateRepositoryCommitComment()
127+
public function shouldCreateRepositoryCommitCommentWithoutLine()
141128
{
142129
$expectedValue = array('comment1data');
143-
$data = array('body' => 'test body', 'commit_id' => 123, 'line' => 53, 'path' => 'test.php', 'position' => 2);
130+
$data = array('body' => 'body', 'path' => 'test.php', 'position' => 2);
144131

145132
$api = $this->getApiMock();
146133
$api->expects($this->once())
147134
->method('post')
148135
->with('repos/KnpLabs/php-github-api/commits/commitSHA123456/comments', $data)
149136
->will($this->returnValue($expectedValue));
150137

151-
$this->assertEquals($expectedValue, $api->create('KnpLabs', 'php-github-api', 'commitSHA123456', $data));
138+
$api->create('KnpLabs', 'php-github-api', 'commitSHA123456', $data);
152139
}
153140

154141
/**
@@ -157,13 +144,11 @@ public function shouldCreateRepositoryCommitComment()
157144
*/
158145
public function shouldNotUpdateWithoutBody()
159146
{
160-
$data = array('commit_id' => 123, 'path' => 'test.php', 'line' => 2);
161-
162147
$api = $this->getApiMock();
163148
$api->expects($this->never())
164149
->method('patch');
165150

166-
$api->update('KnpLabs', 'php-github-api', 'commitSHA123456', $data);
151+
$api->update('KnpLabs', 'php-github-api', 'commitSHA123456', array());
167152
}
168153

169154
/**

0 commit comments

Comments
 (0)