@@ -328,165 +328,62 @@ public function shouldAddHook()
328328 $ api = $ this ->getApiMock ();
329329 $ api ->expects ($ this ->once ())
330330 ->method ('post ' )
331- ->with ('projects/1/hooks ' , array (
332- 'url ' => 'http://www.example.com ' ,
333- 'push_events ' => true ,
334- 'issues_events ' => false ,
335- 'merge_requests_events ' => false ,
336- 'tag_push_events ' => false
337- ))
331+ ->with ('projects/1/hooks ' , array ('url ' => 'http://www.example.com ' , 'push_events ' => true , 'issues_events ' => true , 'merge_requests_events ' => true ))
338332 ->will ($ this ->returnValue ($ expectedArray ))
339333 ;
340334
341- $ this ->assertEquals ($ expectedArray , $ api ->addHook (1 , 'http://www.example.com ' ));
342- }
343-
344- /**
345- * @test
346- */
347- public function shouldAddHookWithoutPushEvents ()
348- {
349- $ expectedArray = array ('id ' => 3 , 'name ' => 'A new hook ' , 'url ' => 'http://www.example.com ' );
350-
351- $ api = $ this ->getApiMock ();
352- $ api ->expects ($ this ->once ())
353- ->method ('post ' )
354- ->with ('projects/1/hooks ' , array (
355- 'url ' => 'http://www.example.com ' ,
356- 'push_events ' => false ,
357- 'issues_events ' => false ,
358- 'merge_requests_events ' => false ,
359- 'tag_push_events ' => false
360- ))
361- ->will ($ this ->returnValue ($ expectedArray ))
362- ;
363-
364- $ this ->assertEquals ($ expectedArray , $ api ->addHook (1 , 'http://www.example.com ' , false ));
365- }
366-
367- /**
368- * @test
369- */
370- public function shouldAddHookWithIssuesEvents ()
371- {
372- $ expectedArray = array ('id ' => 3 , 'name ' => 'A new hook ' , 'url ' => 'http://www.example.com ' );
373-
374- $ api = $ this ->getApiMock ();
375- $ api ->expects ($ this ->once ())
376- ->method ('post ' )
377- ->with ('projects/1/hooks ' , array (
378- 'url ' => 'http://www.example.com ' ,
379- 'push_events ' => false ,
380- 'issues_events ' => true ,
381- 'merge_requests_events ' => false ,
382- 'tag_push_events ' => false
383- ))
384- ->will ($ this ->returnValue ($ expectedArray ))
385- ;
386-
387- $ this ->assertEquals ($ expectedArray , $ api ->addHook (1 , 'http://www.example.com ' , false , true ));
335+ $ this ->assertEquals ($ expectedArray , $ api ->addHook (1 , 'http://www.example.com ' , array ('push_events ' => true , 'issues_events ' => true , 'merge_requests_events ' => true )));
388336 }
389337
390338 /**
391339 * @test
392340 */
393- public function shouldAddHookWithMergeRequestEvents ()
341+ public function shouldAddHookWithOnlyUrl ()
394342 {
395343 $ expectedArray = array ('id ' => 3 , 'name ' => 'A new hook ' , 'url ' => 'http://www.example.com ' );
396344
397345 $ api = $ this ->getApiMock ();
398346 $ api ->expects ($ this ->once ())
399347 ->method ('post ' )
400- ->with ('projects/1/hooks ' , array (
401- 'url ' => 'http://www.example.com ' ,
402- 'push_events ' => false ,
403- 'issues_events ' => false ,
404- 'merge_requests_events ' => true ,
405- 'tag_push_events ' => false
406- ))
348+ ->with ('projects/1/hooks ' , array ('url ' => 'http://www.example.com ' , 'push_events ' => true ))
407349 ->will ($ this ->returnValue ($ expectedArray ))
408350 ;
409351
410- $ this ->assertEquals ($ expectedArray , $ api ->addHook (1 , 'http://www.example.com ' , false , false , true ));
352+ $ this ->assertEquals ($ expectedArray , $ api ->addHook (1 , 'http://www.example.com ' ));
411353 }
412354
413355 /**
414356 * @test
415357 */
416- public function shouldAddHookWithTagPushEvents ()
358+ public function shouldAddHookWithoutPushEvents ()
417359 {
418360 $ expectedArray = array ('id ' => 3 , 'name ' => 'A new hook ' , 'url ' => 'http://www.example.com ' );
419361
420362 $ api = $ this ->getApiMock ();
421363 $ api ->expects ($ this ->once ())
422364 ->method ('post ' )
423- ->with ('projects/1/hooks ' , array (
424- 'url ' => 'http://www.example.com ' ,
425- 'push_events ' => false ,
426- 'issues_events ' => false ,
427- 'merge_requests_events ' => false ,
428- 'tag_push_events ' => true
429- ))
430- ->will ($ this ->returnValue ($ expectedArray ))
431- ;
432-
433- $ this ->assertEquals ($ expectedArray , $ api ->addHook (1 , 'http://www.example.com ' , false , false , false , true ));
434- }
435-
436- /**
437- * @test
438- */
439- public function shouldUpdateHookUrlOnly ()
440- {
441- $ expectedArray = array ('id ' => 3 , 'name ' => 'A new hook ' , 'url ' => 'http://www.example.com ' );
442-
443- $ api = $ this ->getApiMock ();
444- $ api ->expects ($ this ->once ())
445- ->method ('put ' )
446- ->with ('projects/1/hooks/3 ' , array ('url ' => 'http://www.example-test.com ' ))
447- ->will ($ this ->returnValue ($ expectedArray ))
448- ;
449-
450- $ this ->assertEquals ($ expectedArray , $ api ->updateHook (1 , 3 , array ('url ' => 'http://www.example-test.com ' )));
451- }
452-
453- /**
454- * @test
455- */
456- public function shouldUpdateHookWithPushEvents ()
457- {
458- $ expectedArray = array ('id ' => 3 , 'name ' => 'A new hook ' , 'url ' => 'http://www.example.com ' );
459-
460- $ api = $ this ->getApiMock ();
461- $ api ->expects ($ this ->once ())
462- ->method ('put ' )
463- ->with ('projects/1/hooks/3 ' , array ('url ' => 'http://www.example-test.com ' , 'push_events ' => true ))
365+ ->with ('projects/1/hooks ' , array ('url ' => 'http://www.example.com ' , 'push_events ' => false ))
464366 ->will ($ this ->returnValue ($ expectedArray ))
465367 ;
466368
467- $ this ->assertEquals ($ expectedArray , $ api ->updateHook (1 , 3 , array ( ' url ' => ' http://www.example-test .com ' , 'push_events ' => true )));
369+ $ this ->assertEquals ($ expectedArray , $ api ->addHook (1 , ' http://www.example.com ' , array ( 'push_events ' => false )));
468370 }
469371
470372 /**
471373 * @test
472374 */
473- public function shouldUpdateHookWithDifferentEvents ()
375+ public function shouldUpdateHook ()
474376 {
475377 $ expectedArray = array ('id ' => 3 , 'name ' => 'A new hook ' , 'url ' => 'http://www.example.com ' );
476378
477379 $ api = $ this ->getApiMock ();
478380 $ api ->expects ($ this ->once ())
479381 ->method ('put ' )
480- ->with ('projects/1/hooks/3 ' , array (
481- 'url ' => 'http://www.example-test.com ' ,
482- 'issues_events ' => true ,
483- 'merge_requests_events ' => true ,
484- 'tag_push_events ' => true
485- ))
382+ ->with ('projects/1/hooks/3 ' , array ('url ' => 'http://www.example-test.com ' , 'push_events ' => false ))
486383 ->will ($ this ->returnValue ($ expectedArray ))
487384 ;
488385
489- $ this ->assertEquals ($ expectedArray , $ api ->updateHook (1 , 3 , ' http://www.example-test.com ' , false , true , true , true ));
386+ $ this ->assertEquals ($ expectedArray , $ api ->updateHook (1 , 3 , array ( ' url ' => ' http://www.example-test.com ' , ' push_events ' => false ) ));
490387 }
491388
492389 /**
0 commit comments