@@ -65,7 +65,7 @@ public function shouldShowComment()
65
65
*/
66
66
public function shouldNotCreateWithoutBody ()
67
67
{
68
- $ data = array ('commit_id ' => 123 , ' line ' => 53 , 'path ' => 'test.php ' , 'position ' => 2 );
68
+ $ data = array ('line ' => 53 , 'path ' => 'test.php ' , 'position ' => 2 );
69
69
70
70
$ api = $ this ->getApiMock ();
71
71
$ api ->expects ($ this ->never ())
@@ -78,24 +78,9 @@ public function shouldNotCreateWithoutBody()
78
78
* @test
79
79
* @expectedException Github\Exception\MissingArgumentException
80
80
*/
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 ()
97
82
{
98
- $ data = array ('body ' => 'body ' , 'commit_id ' => 123 , ' path ' => ' test.php ' , 'position ' => 2 );
83
+ $ data = array ('body ' => 'body ' , 'line ' => 11 , 'position ' => 2 );
99
84
100
85
$ api = $ this ->getApiMock ();
101
86
$ api ->expects ($ this ->never ())
@@ -108,9 +93,9 @@ public function shouldNotCreateWithoutLine()
108
93
* @test
109
94
* @expectedException Github\Exception\MissingArgumentException
110
95
*/
111
- public function shouldNotCreateWithoutPath ()
96
+ public function shouldNotCreateWithoutPosition ()
112
97
{
113
- $ data = array ('body ' => 'body ' , 'commit_id ' => 123 , ' line ' => 11 , 'position ' => 2 );
98
+ $ data = array ('body ' => 'body ' , 'path ' => ' test.php ' , 'line ' => 2 );
114
99
115
100
$ api = $ this ->getApiMock ();
116
101
$ api ->expects ($ this ->never ())
@@ -121,34 +106,36 @@ public function shouldNotCreateWithoutPath()
121
106
122
107
/**
123
108
* @test
124
- * @expectedException Github\Exception\MissingArgumentException
125
109
*/
126
- public function shouldNotCreateWithoutPosition ()
110
+ public function shouldCreateRepositoryCommitComment ()
127
111
{
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 );
129
114
130
115
$ 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 ));
133
120
134
- $ api ->create ('KnpLabs ' , 'php-github-api ' , 'commitSHA123456 ' , $ data );
121
+ $ this -> assertEquals ( $ expectedValue , $ api ->create ('KnpLabs ' , 'php-github-api ' , 'commitSHA123456 ' , $ data) );
135
122
}
136
123
137
124
/**
138
125
* @test
139
126
*/
140
- public function shouldCreateRepositoryCommitComment ()
127
+ public function shouldCreateRepositoryCommitCommentWithoutLine ()
141
128
{
142
129
$ 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 );
144
131
145
132
$ api = $ this ->getApiMock ();
146
133
$ api ->expects ($ this ->once ())
147
134
->method ('post ' )
148
135
->with ('repos/KnpLabs/php-github-api/commits/commitSHA123456/comments ' , $ data )
149
136
->will ($ this ->returnValue ($ expectedValue ));
150
137
151
- $ this -> assertEquals ( $ expectedValue , $ api ->create ('KnpLabs ' , 'php-github-api ' , 'commitSHA123456 ' , $ data) );
138
+ $ api ->create ('KnpLabs ' , 'php-github-api ' , 'commitSHA123456 ' , $ data );
152
139
}
153
140
154
141
/**
@@ -157,13 +144,11 @@ public function shouldCreateRepositoryCommitComment()
157
144
*/
158
145
public function shouldNotUpdateWithoutBody ()
159
146
{
160
- $ data = array ('commit_id ' => 123 , 'path ' => 'test.php ' , 'line ' => 2 );
161
-
162
147
$ api = $ this ->getApiMock ();
163
148
$ api ->expects ($ this ->never ())
164
149
->method ('patch ' );
165
150
166
- $ api ->update ('KnpLabs ' , 'php-github-api ' , 'commitSHA123456 ' , $ data );
151
+ $ api ->update ('KnpLabs ' , 'php-github-api ' , 'commitSHA123456 ' , array () );
167
152
}
168
153
169
154
/**
0 commit comments