@@ -254,7 +254,7 @@ public function shouldGetBuild()
254254
255255        $ this assertEquals ($ expectedArray$ apibuild (1 , 2 ));
256256    }
257-      
257+ 
258258    /** 
259259     * @test 
260260     */ 
@@ -757,6 +757,106 @@ public function shouldRemoveService()
757757        $ this assertEquals ($ expectedBool$ apiremoveService (1 , 'hipchat ' ));
758758    }
759759
760+     /** 
761+      * @test 
762+      */ 
763+     public  function  shouldGetVariables ()
764+     {
765+         $ expectedArrayarray (
766+             array ('key '  => 'ftp_username ' , 'value '  => 'ftp ' ),
767+             array ('key '  => 'ftp_password ' , 'value '  => 'somepassword ' )
768+         );
769+ 
770+         $ api$ this getApiMock ();
771+         $ apiexpects ($ this once ())
772+             ->method ('get ' )
773+             ->with ('projects/1/variables ' )
774+             ->will ($ this returnValue ($ expectedArray
775+         ;
776+ 
777+         $ this assertEquals ($ expectedArray$ apivariables (1 ));
778+     }
779+ 
780+     /** 
781+      * @test 
782+      */ 
783+     public  function  shouldGetVariable ()
784+     {
785+         $ expectedArrayarray ('key '  => 'ftp_username ' , 'value '  => 'ftp ' );
786+ 
787+         $ api$ this getApiMock ();
788+         $ apiexpects ($ this once ())
789+             ->method ('get ' )
790+             ->with ('projects/1/variables/ftp_username ' )
791+             ->will ($ this returnValue ($ expectedArray
792+         ;
793+ 
794+         $ this assertEquals ($ expectedArray$ apivariable (1 , 'ftp_username ' ));
795+     }
796+ 
797+     /** 
798+      * @test 
799+      */ 
800+     public  function  shouldAddVariable ()
801+     {
802+         $ expectedKey'ftp_port ' ;
803+         $ expectedValue'21 ' ;
804+ 
805+         $ expectedArrayarray (
806+             'key '    => $ expectedKey
807+             'value '  => $ expectedValue
808+         );
809+ 
810+         $ api$ this getApiMock ();
811+         $ apiexpects ($ this once ())
812+             ->method ('post ' )
813+             ->with ('projects/1/variables ' , $ expectedArray
814+             ->will ($ this returnValue ($ expectedArray
815+         ;
816+ 
817+         $ this assertEquals ($ expectedArray$ apiaddVariable (1 , $ expectedKey$ expectedValue
818+     }
819+ 
820+     /** 
821+      * @test 
822+      */ 
823+     public  function  shouldUpdateVariable ()
824+     {
825+         $ expectedKey'ftp_port ' ;
826+         $ expectedValue'22 ' ;
827+ 
828+         $ expectedArrayarray (
829+             'key '    => 'ftp_port ' ,
830+             'value '  => '22 ' ,
831+         );
832+ 
833+         $ api$ this getApiMock ();
834+         $ apiexpects ($ this once ())
835+             ->method ('put ' )
836+             ->with ('projects/1/variables/ ' .$ expectedKeyarray ('value '  => $ expectedValue
837+             ->will ($ this returnValue ($ expectedArray
838+         ;
839+ 
840+         $ this assertEquals ($ expectedArray$ apiupdateVariable (1 , $ expectedKey$ expectedValue
841+     }
842+ 
843+     /** 
844+      * @test 
845+      */ 
846+     public  function  shouldRemoveVariable ()
847+     {
848+         $ expectedBooltrue ;
849+ 
850+         $ api$ this getApiMock ();
851+         $ apiexpects ($ this once ())
852+             ->method ('delete ' )
853+             ->with ('projects/1/variables/ftp_password ' )
854+             ->will ($ this returnValue ($ expectedBool
855+         ;
856+ 
857+         $ this assertEquals ($ expectedBool$ apiremoveVariable (1 , 'ftp_password ' ));
858+     }
859+ 
760860    protected  function  getMultipleProjectsRequestMock ($ path$ expectedArrayarray (), $ page1 , $ per_page20 , $ order_by'created_at ' , $ sort'asc ' )
761861    {
762862        $ api$ this getApiMock ();
0 commit comments