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)
150150 {
151151 return $ this ->get ('/repos/ ' .rawurlencode ($ username ).'/ ' .rawurlencode ($ repository ));
152152 }
153-
153+
154154 /**
155155 * Get extended information about a repository by its id.
156156 * 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()
580580 {
581581 return new Projects ($ this ->client );
582582 }
583-
583+
584584 public function traffic ()
585585 {
586586 return new Traffic ($ this ->client );
587587 }
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+ }
588602}
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ public function shouldShowRepository()
1919
2020 $ this ->assertEquals ($ expectedArray , $ api ->show ('KnpLabs ' , 'php-github-api ' ));
2121 }
22-
22+
2323 /**
2424 * @test
2525 */
@@ -517,6 +517,24 @@ public function shouldGetCommitActivity()
517517 $ this ->assertEquals ($ expectedArray , $ api ->activity ('KnpLabs ' , 'php-github-api ' ));
518518 }
519519
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+
520538 /**
521539 * @return string
522540 */
You can’t perform that action at this time.
0 commit comments