@@ -152,6 +152,109 @@ public function testReleaseVersionParameterMerging()
152152 $ this ->assertFalse ($ this ->api ->releaseVersion (111000 , $ release_date , array ('test ' => 'extra ' )));
153153 }
154154
155+ /**
156+ * @dataProvider createRemoteLinkDataProvider
157+ */
158+ public function testCreateRemoteLink (array $ method_params , array $ expected_api_params )
159+ {
160+ $ response = file_get_contents (__DIR__ . '/resources/api_create_remote_link.json ' );
161+
162+ $ this ->expectClientCall (
163+ Api::REQUEST_POST ,
164+ '/rest/api/2/issue/JRE-123/remotelink ' ,
165+ $ expected_api_params ,
166+ $ response
167+ );
168+
169+ $ expected = json_decode ($ response , true );
170+ $ actual = call_user_func_array (array ($ this ->api , 'createRemoteLink ' ), $ method_params );
171+
172+ if ( $ actual !== false ) {
173+ $ this ->assertEquals ($ expected , $ actual );
174+ }
175+ }
176+
177+ public static function createRemoteLinkDataProvider ()
178+ {
179+ return array (
180+ 'object only ' => array (
181+ array (
182+ 'JRE-123 ' ,
183+ array (
184+ 'title ' => 'TSTSUP-111 ' ,
185+ 'url ' => 'http://www.mycompany.com/support?id=1 ' ,
186+ ),
187+ ),
188+ array (
189+ 'object ' => array (
190+ 'title ' => 'TSTSUP-111 ' ,
191+ 'url ' => 'http://www.mycompany.com/support?id=1 ' ,
192+ ),
193+ ),
194+ ),
195+ 'object+relationship ' => array (
196+ array (
197+ 'JRE-123 ' ,
198+ array (
199+ 'title ' => 'TSTSUP-111 ' ,
200+ 'url ' => 'http://www.mycompany.com/support?id=1 ' ,
201+ ),
202+ 'blocked by ' ,
203+ ),
204+ array (
205+ 'relationship ' => 'blocked by ' ,
206+ 'object ' => array (
207+ 'title ' => 'TSTSUP-111 ' ,
208+ 'url ' => 'http://www.mycompany.com/support?id=1 ' ,
209+ ),
210+ ),
211+ ),
212+ 'object+global_id ' => array (
213+ array (
214+ 'JRE-123 ' ,
215+ array (
216+ 'title ' => 'TSTSUP-111 ' ,
217+ 'url ' => 'http://www.mycompany.com/support?id=1 ' ,
218+ ),
219+ null ,
220+ 'global-id ' ,
221+ ),
222+ array (
223+ 'globalId ' => 'global-id ' ,
224+ 'object ' => array (
225+ 'title ' => 'TSTSUP-111 ' ,
226+ 'url ' => 'http://www.mycompany.com/support?id=1 ' ,
227+ ),
228+ ),
229+ ),
230+ 'object+application ' => array (
231+ array (
232+ 'JRE-123 ' ,
233+ array (
234+ 'title ' => 'TSTSUP-111 ' ,
235+ 'url ' => 'http://www.mycompany.com/support?id=1 ' ,
236+ ),
237+ null ,
238+ null ,
239+ array (
240+ 'name ' => 'My Acme Tracker ' ,
241+ 'type ' => 'com.acme.tracker ' ,
242+ ),
243+ ),
244+ array (
245+ 'object ' => array (
246+ 'title ' => 'TSTSUP-111 ' ,
247+ 'url ' => 'http://www.mycompany.com/support?id=1 ' ,
248+ ),
249+ 'application ' => array (
250+ 'name ' => 'My Acme Tracker ' ,
251+ 'type ' => 'com.acme.tracker ' ,
252+ ),
253+ ),
254+ ),
255+ );
256+ }
257+
155258 public function testFindVersionByName ()
156259 {
157260 $ project_key = 'POR ' ;
0 commit comments