@@ -267,6 +267,111 @@ public function shouldGetPipelines()
267267 $ this ->assertEquals ($ expectedArray , $ api ->pipelines (1 ));
268268 }
269269
270+ /**
271+ * Check we can request project issues.
272+ *
273+ * @test
274+ */
275+ public function shouldGetProjectIssues () {
276+ $ expectedArray = $ this ->getProjectIssuesExpectedArray ();
277+
278+ $ api = $ this ->getApiMock ();
279+ $ api ->expects ($ this ->once ())
280+ ->method ('get ' )
281+ ->with ('projects/1/issues ' )
282+ ->will ($ this ->returnValue ($ expectedArray ));
283+
284+ $ this ->assertEquals ($ expectedArray , $ api ->issues (1 ));
285+ }
286+
287+ /**
288+ * Check we can request project issues with query parameters.
289+ *
290+ * @test
291+ */
292+ public function shouldGetProjectIssuesParameters () {
293+ $ expectedArray = $ this ->getProjectIssuesExpectedArray ();
294+
295+ $ api = $ this ->getApiMock ();
296+ $ api ->expects ($ this ->once ())
297+ ->method ('get ' )
298+ ->with ('projects/1/issues ' )
299+ ->will ($ this ->returnValue ($ expectedArray ));
300+
301+ $ this ->assertEquals ($ expectedArray , $ api ->issues (1 , array ('state ' => 'opened ' )));
302+ }
303+
304+ /**
305+ * Get expected array for tests which check project issues method.
306+ *
307+ * @return array
308+ * Project issues list.
309+ */
310+ public function getProjectIssuesExpectedArray () {
311+ return [
312+ [
313+ 'state ' => 'opened ' ,
314+ 'description ' => 'Ratione dolores corrupti mollitia soluta quia. ' ,
315+ 'author ' => [
316+ 'state ' => 'active ' ,
317+ 'id ' => 18 ,
318+ 'web_url ' => 'https => //gitlab.example.com/eileen.lowe ' ,
319+ 'name ' => 'Alexandra Bashirian ' ,
320+ 'avatar_url ' => null ,
321+ 'username ' => 'eileen.lowe '
322+ ],
323+ 'milestone ' => [
324+ 'project_id ' => 1 ,
325+ 'description ' => 'Ducimus nam enim ex consequatur cumque ratione. ' ,
326+ 'state ' => 'closed ' ,
327+ 'due_date ' => null ,
328+ 'iid ' => 2 ,
329+ 'created_at ' => '2016-01-04T15 => 31 => 39.996Z ' ,
330+ 'title ' => 'v4.0 ' ,
331+ 'id ' => 17 ,
332+ 'updated_at ' => '2016-01-04T15 => 31 => 39.996Z '
333+ ],
334+ 'project_id ' => 1 ,
335+ 'assignees ' => [[
336+ 'state ' => 'active ' ,
337+ 'id ' => 1 ,
338+ 'name ' => 'Administrator ' ,
339+ 'web_url ' => 'https => //gitlab.example.com/root ' ,
340+ 'avatar_url ' => null ,
341+ 'username ' => 'root '
342+ ]],
343+ 'assignee ' => [
344+ 'state ' => 'active ' ,
345+ 'id ' => 1 ,
346+ 'name ' => 'Administrator ' ,
347+ 'web_url ' => 'https => //gitlab.example.com/root ' ,
348+ 'avatar_url ' => null ,
349+ 'username ' => 'root '
350+ ],
351+ 'updated_at ' => '2016-01-04T15 => 31 => 51.081Z ' ,
352+ 'closed_at ' => null ,
353+ 'closed_by ' => null ,
354+ 'id ' => 76 ,
355+ 'title ' => 'Consequatur vero maxime deserunt laboriosam est voluptas dolorem. ' ,
356+ 'created_at ' => '2016-01-04T15 => 31 => 51.081Z ' ,
357+ 'iid ' => 6 ,
358+ 'labels ' => [],
359+ 'user_notes_count ' => 1 ,
360+ 'due_date ' => '2016-07-22 ' ,
361+ 'web_url ' => 'http => //example.com/example/example/issues/6 ' ,
362+ 'confidential ' => false ,
363+ 'weight ' => null ,
364+ 'discussion_locked ' => false ,
365+ 'time_stats ' => [
366+ 'time_estimate ' => 0 ,
367+ 'total_time_spent ' => 0 ,
368+ 'human_time_estimate ' => null ,
369+ 'human_total_time_spent ' => null
370+ ],
371+ ]
372+ ];
373+ }
374+
270375 /**
271376 * @test
272377 */
0 commit comments