@@ -70,6 +70,18 @@ public function shouldGetOwnedProjects()
70
70
$ this ->assertEquals ($ expectedArray , $ api ->all (['owned ' => true ]));
71
71
}
72
72
73
+ /**
74
+ * @test
75
+ */
76
+ public function shouldGetNotArchivedProjects ()
77
+ {
78
+ $ expectedArray = $ this ->getMultipleProjectsData ();
79
+
80
+ $ api = $ this ->getMultipleProjectsRequestMock ('projects ' , $ expectedArray , ['archived ' => 'false ' ]);
81
+
82
+ $ this ->assertEquals ($ expectedArray , $ api ->all (['archived ' => false ]));
83
+ }
84
+
73
85
/**
74
86
* @test
75
87
*/
@@ -228,6 +240,27 @@ public function shouldGetPipelines()
228
240
$ this ->assertEquals ($ expectedArray , $ api ->pipelines (1 ));
229
241
}
230
242
243
+ /**
244
+ * @test
245
+ */
246
+ public function shouldGetPipelinesWithBooleanParam ()
247
+ {
248
+ $ expectedArray = array (
249
+ array ('id ' => 1 , 'status ' => 'success ' ,'ref ' => 'new-pipeline ' ),
250
+ array ('id ' => 2 , 'status ' => 'failed ' , 'ref ' => 'new-pipeline ' ),
251
+ array ('id ' => 3 , 'status ' => 'pending ' , 'ref ' => 'test-pipeline ' )
252
+ );
253
+
254
+ $ api = $ this ->getApiMock ();
255
+ $ api ->expects ($ this ->once ())
256
+ ->method ('get ' )
257
+ ->with ('projects/1/pipelines ' , ['yaml_errors ' => 'false ' ])
258
+ ->will ($ this ->returnValue ($ expectedArray ))
259
+ ;
260
+
261
+ $ this ->assertEquals ($ expectedArray , $ api ->pipelines (1 , ['yaml_errors ' => false ]));
262
+ }
263
+
231
264
/**
232
265
* @test
233
266
*/
@@ -660,6 +693,34 @@ public function shouldGetEvents()
660
693
$ this ->assertEquals ($ expectedArray , $ api ->events (1 ));
661
694
}
662
695
696
+ /**
697
+ * @test
698
+ */
699
+ public function shouldGetEventsWithDateTimeParams ()
700
+ {
701
+ $ expectedArray = [
702
+ ['id ' => 1 , 'title ' => 'An event ' ],
703
+ ['id ' => 2 , 'title ' => 'Another event ' ]
704
+ ];
705
+
706
+ $ after = new \DateTime ('2018-01-01 00:00:00 ' );
707
+ $ before = new \DateTime ('2018-01-31 00:00:00 ' );
708
+
709
+ $ expectedWithArray = [
710
+ 'after ' => $ after ->format ('Y-m-d ' ),
711
+ 'before ' => $ before ->format ('Y-m-d ' ),
712
+ ];
713
+
714
+ $ api = $ this ->getApiMock ();
715
+ $ api ->expects ($ this ->once ())
716
+ ->method ('get ' )
717
+ ->with ('projects/1/events ' , $ expectedWithArray )
718
+ ->will ($ this ->returnValue ($ expectedArray ))
719
+ ;
720
+
721
+ $ this ->assertEquals ($ expectedArray , $ api ->events (1 , ['after ' => $ after , 'before ' => $ before ]));
722
+ }
723
+
663
724
/**
664
725
* @test
665
726
*/
0 commit comments