@@ -642,6 +642,122 @@ public function shouldGetMembersWithPagination()
642
642
$ this ->assertEquals ($ expectedArray , $ api ->members (1 , array ('page ' => 2 , 'per_page ' => 15 )));
643
643
}
644
644
645
+ /**
646
+ * Get expected array for tests which check project members all
647
+ *
648
+ * @return array
649
+ * Project issues list.
650
+ */
651
+ public function getMembersAllExpectedArray ()
652
+ {
653
+ return [
654
+ [
655
+ "id " => 1 ,
656
+ "username " => "raymond_smith " ,
657
+ "name " => "Raymond Smith " ,
658
+ "state " => "active " ,
659
+ "avatar_url " => "https://www.gravatar.com/avatar/c2525a7f58ae3776070e44c106c48e15?s=80&d=identicon " ,
660
+ "web_url " => "http://192.168.1.8:3000/root " ,
661
+ "expires_at " => "2012-10-22T14:13:35Z " ,
662
+ "access_level " => 30
663
+ ],
664
+ [
665
+ "id " => 2 ,
666
+ "username " => "john_doe " ,
667
+ "name " => "John Doe " ,
668
+ "state " => "active " ,
669
+ "avatar_url " => "https://www.gravatar.com/avatar/c2525a7f58ae3776070e44c106c48e15?s=80&d=identicon " ,
670
+ "web_url " => "http://192.168.1.8:3000/root " ,
671
+ "expires_at " => "2012-10-22T14:13:35Z " ,
672
+ "access_level " => 40
673
+ ],
674
+ [
675
+ "id " => 3 ,
676
+ "username " => "mr_admin " ,
677
+ "name " => "Mr Admin " ,
678
+ "state " => "active " ,
679
+ "avatar_url " => "https://www.gravatar.com/avatar/c2525a7f58ae3776070e44c106c48e15?s=80&d=identicon " ,
680
+ "web_url " => "http://192.168.1.8:3000/root " ,
681
+ "expires_at " => "2012-11-22T14:13:35Z " ,
682
+ "access_level " => 50
683
+ ]
684
+ ];
685
+ }
686
+
687
+ /**
688
+ * @test
689
+ */
690
+ public function shouldGetMembersAll ()
691
+ {
692
+ $ expectedArray = $ this ->getMembersAllExpectedArray ();
693
+
694
+ $ api = $ this ->getApiMock ();
695
+ $ api ->expects ($ this ->once ())
696
+ ->method ('get ' )
697
+ ->with ('projects/1/members/all ' )
698
+ ->will ($ this ->returnValue ($ expectedArray ))
699
+ ;
700
+
701
+ $ this ->assertEquals ($ expectedArray , $ api ->membersAll (1 ));
702
+ }
703
+
704
+ /**
705
+ * @test
706
+ */
707
+ public function shouldGetMembersAllWithQuery ()
708
+ {
709
+ $ expectedmMembersAllArray = $ this ->getMembersAllExpectedArray ();
710
+ $ expectedArray = array (
711
+ $ expectedmMembersAllArray [0 ]
712
+ );
713
+
714
+ $ api = $ this ->getApiMock ();
715
+ $ api ->expects ($ this ->once ())
716
+ ->method ('get ' )
717
+ ->with ('projects/1/members/all ' , array ('query ' => 'at ' ))
718
+ ->will ($ this ->returnValue ($ expectedArray ))
719
+ ;
720
+
721
+ $ this ->assertEquals ($ expectedArray , $ api ->membersAll (1 , 'at ' ));
722
+ }
723
+
724
+ /**
725
+ * @test
726
+ */
727
+ public function shouldGetMembersAllWithNullQuery ()
728
+ {
729
+ $ expectedArray = $ this ->getMembersAllExpectedArray ();
730
+
731
+ $ api = $ this ->getApiMock ();
732
+ $ api ->expects ($ this ->once ())
733
+ ->method ('get ' )
734
+ ->with ('projects/1/members/all ' )
735
+ ->will ($ this ->returnValue ($ expectedArray ))
736
+ ;
737
+
738
+ $ this ->assertEquals ($ expectedArray , $ api ->membersAll (1 , null ));
739
+ }
740
+
741
+ /**
742
+ * @test
743
+ */
744
+ public function shouldGetMembersAllWithPagination ()
745
+ {
746
+ $ expectedArray = $ this ->getMembersAllExpectedArray ();
747
+
748
+ $ api = $ this ->getApiMock ();
749
+ $ api ->expects ($ this ->once ())
750
+ ->method ('get ' )
751
+ ->with ('projects/1/members/all ' , array (
752
+ 'page ' => 2 ,
753
+ 'per_page ' => 15
754
+ ))
755
+ ->will ($ this ->returnValue ($ expectedArray ))
756
+ ;
757
+
758
+ $ this ->assertEquals ($ expectedArray , $ api ->membersAll (1 , array ('page ' => 2 , 'per_page ' => 15 )));
759
+ }
760
+
645
761
/**
646
762
* @test
647
763
*/
0 commit comments