File tree Expand file tree Collapse file tree 2 files changed +35
-3
lines changed Expand file tree Collapse file tree 2 files changed +35
-3
lines changed Original file line number Diff line number Diff line change @@ -150,7 +150,7 @@ public function show($username, $repository)
150
150
{
151
151
return $ this ->get ('/repos/ ' .rawurlencode ($ username ).'/ ' .rawurlencode ($ repository ));
152
152
}
153
-
153
+
154
154
/**
155
155
* Get extended information about a repository by its id.
156
156
* Note: at time of writing this is an undocumented feature but GitHub support have advised that it can be relied on.
@@ -580,9 +580,23 @@ public function projects()
580
580
{
581
581
return new Projects ($ this ->client );
582
582
}
583
-
583
+
584
584
public function traffic ()
585
585
{
586
586
return new Traffic ($ this ->client );
587
587
}
588
+
589
+ /**
590
+ * @param string $username
591
+ * @param string $repository
592
+ * @param int $page
593
+ *
594
+ * @return array|string
595
+ *
596
+ * @see https://developer.github.com/v3/activity/events/#list-repository-events
597
+ */
598
+ public function events ($ username , $ repository , $ page = 1 )
599
+ {
600
+ return $ this ->get ('/repos/ ' .rawurldecode ($ username ).'/ ' .rawurldecode ($ repository ).'/events ' , ['page ' => $ page ]);
601
+ }
588
602
}
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ public function shouldShowRepository()
19
19
20
20
$ this ->assertEquals ($ expectedArray , $ api ->show ('KnpLabs ' , 'php-github-api ' ));
21
21
}
22
-
22
+
23
23
/**
24
24
* @test
25
25
*/
@@ -517,6 +517,24 @@ public function shouldGetCommitActivity()
517
517
$ this ->assertEquals ($ expectedArray , $ api ->activity ('KnpLabs ' , 'php-github-api ' ));
518
518
}
519
519
520
+ /**
521
+ * @test
522
+ */
523
+ public function shouldGetRepositoryEvents ()
524
+ {
525
+ $ expectedArray = array ('id ' => 6122723754 , 'type ' => 'ForkEvent ' );
526
+
527
+ $ api = $ this ->getApiMock ();
528
+ $ api ->expects ($ this ->once ())
529
+ ->method ('get ' )
530
+ ->with ('/repos/KnpLabs/php-github-api/events ' , array (
531
+ 'page ' => 3 ,
532
+ ))
533
+ ->will ($ this ->returnValue ($ expectedArray ));
534
+
535
+ $ this ->assertEquals ($ expectedArray , $ api ->events ('KnpLabs ' , 'php-github-api ' , 3 ));
536
+ }
537
+
520
538
/**
521
539
* @return string
522
540
*/
You can’t perform that action at this time.
0 commit comments