@@ -112,78 +112,139 @@ public function shouldGetAllBoards()
112
112
//
113
113
// $this->assertEquals($expectedArray, $api->update(1, 2, array('title' => 'A renamed issue', 'labels' => 'foo')));
114
114
// }
115
- //
116
- // /**
117
- // * @test
118
- // */
119
- // public function shouldGetIssueComments()
120
- // {
121
- // $expectedArray = array(
122
- // array('id' => 1, 'body' => 'A comment'),
123
- // array('id' => 2, 'body' => 'Another comment')
124
- // );
125
- //
126
- // $api = $this->getApiMock();
127
- // $api->expects($this->once())
128
- // ->method('get')
129
- // ->with('projects/1/issues/2/notes')
130
- // ->will($this->returnValue($expectedArray))
131
- // ;
132
- //
133
- // $this->assertEquals($expectedArray, $api->showComments(1, 2));
134
- // }
135
- //
136
- // /**
137
- // * @test
138
- // */
139
- // public function shouldGetIssueComment()
140
- // {
141
- // $expectedArray = array('id' => 3, 'body' => 'A new comment');
142
- //
143
- // $api = $this->getApiMock();
144
- // $api->expects($this->once())
145
- // ->method('get')
146
- // ->with('projects/1/issues/2/notes/3')
147
- // ->will($this->returnValue($expectedArray))
148
- // ;
149
- //
150
- // $this->assertEquals($expectedArray, $api->showComment(1, 2, 3));
151
- // }
152
- //
153
- // /**
154
- // * @test
155
- // */
156
- // public function shouldCreateComment()
157
- // {
158
- // $expectedArray = array('id' => 3, 'body' => 'A new comment');
159
- //
160
- // $api = $this->getApiMock();
161
- // $api->expects($this->exactly(2))
162
- // ->method('post')
163
- // ->with('projects/1/issues/2/notes', array('body' => 'A new comment'))
164
- // ->will($this->returnValue($expectedArray))
165
- // ;
166
- //
167
- // $this->assertEquals($expectedArray, $api->addComment(1, 2, array('body' => 'A new comment')));
168
- // $this->assertEquals($expectedArray, $api->addComment(1, 2, 'A new comment'));
169
- // }
170
- //
171
- // /**
172
- // * @test
173
- // */
174
- // public function shouldUpdateComment()
175
- // {
176
- // $expectedArray = array('id' => 3, 'body' => 'An edited comment');
177
- //
178
- // $api = $this->getApiMock();
179
- // $api->expects($this->once())
180
- // ->method('put')
181
- // ->with('projects/1/issues/2/notes/3', array('body' => 'An edited comment'))
182
- // ->will($this->returnValue($expectedArray))
183
- // ;
184
- //
185
- // $this->assertEquals($expectedArray, $api->updateComment(1, 2, 3, 'An edited comment'));
186
- // }
115
+
116
+ /**
117
+ * @test
118
+ */
119
+ public function shouldGetAllLists ()
120
+ {
121
+ $ expectedArray = array (
122
+ array (
123
+ 'id ' => 1 ,
124
+ 'label ' => array (
125
+ 'name ' => 'First label ' ,
126
+ 'color ' => '#F0AD4E ' ,
127
+ 'description ' => null
128
+ ),
129
+ 'position ' => 1
130
+ ), array (
131
+ 'id ' => 2 ,
132
+ 'label ' => array (
133
+ 'name ' => 'Second label ' ,
134
+ 'color ' => '#F0AD4E ' ,
135
+ 'description ' => null
136
+ ),
137
+ 'position ' => 2
138
+ )
139
+ );
140
+
141
+ $ api = $ this ->getApiMock ();
142
+ $ api ->expects ($ this ->once ())
143
+ ->method ('get ' )
144
+ ->with ('projects/1/boards/2/lists ' )
145
+ ->will ($ this ->returnValue ($ expectedArray ))
146
+ ;
147
+
148
+ $ this ->assertEquals ($ expectedArray , $ api ->allLists (1 , 2 ));
149
+ }
150
+
151
+ /**
152
+ * @test
153
+ */
154
+ public function shouldGetList ()
155
+ {
156
+ $ expectedArray = array (
157
+ array (
158
+ 'id ' => 3 ,
159
+ 'label ' => array (
160
+ 'name ' => 'Some label ' ,
161
+ 'color ' => '#F0AD4E ' ,
162
+ 'description ' => null
163
+ ),
164
+ 'position ' => 3
165
+ )
166
+ );
167
+
168
+ $ api = $ this ->getApiMock ();
169
+ $ api ->expects ($ this ->once ())
170
+ ->method ('get ' )
171
+ ->with ('projects/1/boards/2/lists/3 ' )
172
+ ->will ($ this ->returnValue ($ expectedArray ))
173
+ ;
174
+
175
+ $ this ->assertEquals ($ expectedArray , $ api ->showList (1 , 2 , 3 ));
176
+ }
177
+
178
+ /**
179
+ * @test
180
+ */
181
+ public function shouldCreateList ()
182
+ {
183
+ $ expectedArray = array (
184
+ array (
185
+ 'id ' => 3 ,
186
+ 'label ' => array (
187
+ 'name ' => 'Some label ' ,
188
+ 'color ' => '#F0AD4E ' ,
189
+ 'description ' => null
190
+ ),
191
+ 'position ' => 3
192
+ )
193
+ );
194
+
195
+ $ api = $ this ->getApiMock ();
196
+ $ api ->expects ($ this ->once ())
197
+ ->method ('post ' )
198
+ ->with ('projects/1/boards/2/lists ' , array ('label_id ' => 4 ))
199
+ ->will ($ this ->returnValue ($ expectedArray ))
200
+ ;
201
+
202
+ $ this ->assertEquals ($ expectedArray , $ api ->createList (1 , 2 , 4 ));
203
+ }
204
+
205
+ /**
206
+ * @test
207
+ */
208
+ public function shouldUpdateList ()
209
+ {
210
+ $ expectedArray = array (
211
+ array (
212
+ 'id ' => 3 ,
213
+ 'label ' => array (
214
+ 'name ' => 'Some label ' ,
215
+ 'color ' => '#F0AD4E ' ,
216
+ 'description ' => null
217
+ ),
218
+ 'position ' => 1
219
+ )
220
+ );
221
+
222
+ $ api = $ this ->getApiMock ();
223
+ $ api ->expects ($ this ->once ())
224
+ ->method ('put ' )
225
+ ->with ('projects/5/boards/2/lists/3 ' , array ('position ' => 1 ))
226
+ ->will ($ this ->returnValue ($ expectedArray ))
227
+ ;
228
+
229
+ $ this ->assertEquals ($ expectedArray , $ api ->updateList (5 , 2 , 3 , 1 ));
230
+ }
231
+
232
+ /**
233
+ * @test
234
+ */
235
+ public function shouldDeleteList ()
236
+ {
237
+ $ expectedBool = true ;
238
+
239
+ $ api = $ this ->getApiMock ();
240
+ $ api ->expects ($ this ->once ())
241
+ ->method ('delete ' )
242
+ ->with ('projects/1/boards/2/lists/3 ' )
243
+ ->will ($ this ->returnValue ($ expectedBool ))
244
+ ;
245
+
246
+ $ this ->assertEquals ($ expectedBool , $ api ->deleteList (1 , 2 , 3 ));
247
+ }
187
248
188
249
protected function getApiClass ()
189
250
{
0 commit comments