コード例 #1
0
ファイル: DocTest.php プロジェクト: webguyblake/php-kit
 public function testGeoPoint()
 {
     $json = "{\"id\":\"abcd\",\"type\":\"article\",\"href\":\"\",\"slugs\":[],\"tags\":[],\"data\":{\"article\":{\"location\":{\"type\":\"GeoPoint\",\"value\":{\"latitude\":48.877108,\"longitude\":2.333879}}}}}";
     $doc = Document::parse(json_decode($json));
     // startgist:4a4024327fc8454bc809:prismic-geopoint.php
     // "near" predicate for GeoPoint fragments
     $near = Predicates::near("my.store.location", 48.8768767, 2.3338802, 10);
     // Accessing GeoPoint fragments
     $place = $doc->getGeoPoint("article.location");
     $coordinates = "";
     if ($place) {
         $coordinates = $place->getLatitude() . "," . $place->getLongitude();
     }
     // endgist
     $this->assertEquals("48.877108,2.333879", $coordinates);
 }
コード例 #2
0
 public function testGeopointNear()
 {
     $p = Predicates::near("my.store.coordinates", 40.689757, -74.0451453, 15);
     $this->assertEquals("[:d = geopoint.near(my.store.coordinates, 40.689757, -74.0451453, 15)]", $p->q());
 }