diff --git a/src/POI/POI.php b/src/POI/POI.php index 8ca69971c7..35b7a575a3 100644 --- a/src/POI/POI.php +++ b/src/POI/POI.php @@ -33,6 +33,18 @@ class POI extends AbstractAPI const API_LIST = 'http://api.weixin.qq.com/cgi-bin/poi/getpoilist'; const API_UPDATE = 'http://api.weixin.qq.com/cgi-bin/poi/updatepoi'; const API_DELETE = 'http://api.weixin.qq.com/cgi-bin/poi/delpoi'; + const API_GET_CATEGORIES = 'http://api.weixin.qq.com/cgi-bin/poi/getwxcategory'; + + + /** + * Get POI supported categories. + * + * @return \EasyWeChat\Support\Collection + */ + public function getCategories() + { + return $this->parseJSON('get', [self::API_GET_CATEGORIES]); + } /** * Get POI by ID. diff --git a/tests/POI/POIPOITest.php b/tests/POI/POIPOITest.php index c4634b5cf3..9cd0a84b8d 100755 --- a/tests/POI/POIPOITest.php +++ b/tests/POI/POIPOITest.php @@ -26,6 +26,17 @@ public function getPOI() return $POI; } + /** + * Test getCategories(). + */ + public function testGetCategories() + { + $POI = $this->getPOI(); + + $response = $POI->getCategories(); + $this->assertStringStartsWith(POI::API_GET_CATEGORIES, $response['api']); + } + /** * Test get(). */