@@ -822,4 +822,69 @@ public function shouldRebaseMergeRequest(): void
822822 'skip_ci ' => true ,
823823 ]));
824824 }
825+
826+ #[Test]
827+ public function shouldCreateDependency (): void
828+ {
829+ $ expectedArray = ['id ' => 1 , 'blocking_merge_request_id ' => 3 ];
830+
831+ $ api = $ this ->getApiMock ();
832+ $ api ->expects ($ this ->once ())
833+ ->method ('post ' )
834+ ->with ('projects/1/merge_requests/2/blocks/3 ' )
835+ ->willReturn ($ expectedArray )
836+ ;
837+
838+ $ this ->assertEquals ($ expectedArray , $ api ->createDependency (1 , 2 , 3 ));
839+ }
840+
841+ #[Test]
842+ public function shouldGetDependencies (): void
843+ {
844+ $ expectedArray = [
845+ ['id ' => 1 , 'blocking_merge_request_id ' => 3 ],
846+ ['id ' => 2 , 'blocking_merge_request_id ' => 4 ],
847+ ];
848+
849+ $ api = $ this ->getApiMock ();
850+ $ api ->expects ($ this ->once ())
851+ ->method ('get ' )
852+ ->with ('projects/1/merge_requests/2/blocks ' )
853+ ->willReturn ($ expectedArray )
854+ ;
855+
856+ $ this ->assertEquals ($ expectedArray , $ api ->dependencies (1 , 2 ));
857+ }
858+
859+ #[Test]
860+ public function shouldDeleteDependency (): void
861+ {
862+ $ expectedBool = true ;
863+
864+ $ api = $ this ->getApiMock ();
865+ $ api ->expects ($ this ->once ())
866+ ->method ('delete ' )
867+ ->with ('projects/1/merge_requests/2/blocks/3 ' )
868+ ->willReturn ($ expectedBool );
869+
870+ $ this ->assertEquals ($ expectedBool , $ api ->deleteDependency (1 , 2 , 3 ));
871+ }
872+
873+ #[Test]
874+ public function shouldGetBlockedMergeRequests (): void
875+ {
876+ $ expectedArray = [
877+ ['id ' => 3 , 'project_id ' => 1 , 'blocking_merge_request ' => [], 'blocked_merge_request ' => []],
878+ ['id ' => 4 , 'project_id ' => 1 , 'blocking_merge_request ' => [], 'blocked_merge_request ' => []],
879+ ];
880+
881+ $ api = $ this ->getApiMock ();
882+ $ api ->expects ($ this ->once ())
883+ ->method ('get ' )
884+ ->with ('projects/1/merge_requests/2/blockees ' )
885+ ->willReturn ($ expectedArray )
886+ ;
887+
888+ $ this ->assertEquals ($ expectedArray , $ api ->blockedMrs (1 , 2 ));
889+ }
825890}
0 commit comments