@@ -328,165 +328,62 @@ public function shouldAddHook()
328
328
$ api = $ this ->getApiMock ();
329
329
$ api ->expects ($ this ->once ())
330
330
->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 ))
338
332
->will ($ this ->returnValue ($ expectedArray ))
339
333
;
340
334
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 )));
388
336
}
389
337
390
338
/**
391
339
* @test
392
340
*/
393
- public function shouldAddHookWithMergeRequestEvents ()
341
+ public function shouldAddHookWithOnlyUrl ()
394
342
{
395
343
$ expectedArray = array ('id ' => 3 , 'name ' => 'A new hook ' , 'url ' => 'http://www.example.com ' );
396
344
397
345
$ api = $ this ->getApiMock ();
398
346
$ api ->expects ($ this ->once ())
399
347
->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 ))
407
349
->will ($ this ->returnValue ($ expectedArray ))
408
350
;
409
351
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 ' ));
411
353
}
412
354
413
355
/**
414
356
* @test
415
357
*/
416
- public function shouldAddHookWithTagPushEvents ()
358
+ public function shouldAddHookWithoutPushEvents ()
417
359
{
418
360
$ expectedArray = array ('id ' => 3 , 'name ' => 'A new hook ' , 'url ' => 'http://www.example.com ' );
419
361
420
362
$ api = $ this ->getApiMock ();
421
363
$ api ->expects ($ this ->once ())
422
364
->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 ))
464
366
->will ($ this ->returnValue ($ expectedArray ))
465
367
;
466
368
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 )));
468
370
}
469
371
470
372
/**
471
373
* @test
472
374
*/
473
- public function shouldUpdateHookWithDifferentEvents ()
375
+ public function shouldUpdateHook ()
474
376
{
475
377
$ expectedArray = array ('id ' => 3 , 'name ' => 'A new hook ' , 'url ' => 'http://www.example.com ' );
476
378
477
379
$ api = $ this ->getApiMock ();
478
380
$ api ->expects ($ this ->once ())
479
381
->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 ))
486
383
->will ($ this ->returnValue ($ expectedArray ))
487
384
;
488
385
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 ) ));
490
387
}
491
388
492
389
/**
0 commit comments