@@ -504,6 +504,7 @@ function test_create_location_h_geo() {
504504
505505 $ this ->assertEquals ( '42.361 ' , get_post_meta ( $ post ->ID , 'geo_latitude ' , true ) );
506506 $ this ->assertEquals ( '-71.092 ' , get_post_meta ( $ post ->ID , 'geo_longitude ' , true ) );
507+ $ this ->assertEquals ( '25000 ' , get_post_meta ( $ post ->ID , 'geo_altitude ' , true ) );
507508 $ this ->assertEquals ( '' , get_post_meta ( $ post ->ID , 'geo_address ' , true ) );
508509 }
509510
@@ -525,17 +526,62 @@ function test_create_location_h_adr() {
525526 $ this ->assertEquals ( '' , get_post_meta ( $ post ->ID , 'geo_address ' , true ) );
526527 }
527528
529+ function test_create_location_geo_with_altitude () {
530+ Recorder::$ request_headers = array ( 'content-type ' => 'application/json; charset=utf-8 ' );
531+ Recorder::$ input = static ::$ mf2 ;
532+ Recorder::$ input ['properties ' ]['location ' ] = array ( 'geo:42.361,-71.092,1500;u=25000 ' );
533+ $ post = self ::check_create ();
534+
535+ $ this ->assertEquals ( '42.361 ' , get_post_meta ( $ post ->ID , 'geo_latitude ' , true ) );
536+ $ this ->assertEquals ( '-71.092 ' , get_post_meta ( $ post ->ID , 'geo_longitude ' , true ) );
537+ $ this ->assertEquals ( '1500 ' , get_post_meta ( $ post ->ID , 'geo_altitude ' , true ) );
538+ }
539+
528540 function test_create_location_plain_text () {
529541 Recorder::$ request_headers = array ( 'content-type ' => 'application/json; charset=utf-8 ' );
530542 Recorder::$ input = static ::$ mf2 ;
531543 Recorder::$ input ['properties ' ]['location ' ] = array ( 'foo bar baz ' );
532544 $ post = self ::check_create ();
533-
534545 $ this ->assertEquals ( 'foo bar baz ' , get_post_meta ( $ post ->ID , 'geo_address ' , true ) );
535546 $ this ->assertEquals ( '' , get_post_meta ( $ post ->ID , 'geo_latitude ' , true ) );
536547 $ this ->assertEquals ( '' , get_post_meta ( $ post ->ID , 'geo_longitude ' , true ) );
537548 }
538549
550+ function test_create_location_visibility_private () {
551+ Recorder::$ request_headers = array ( 'content-type ' => 'application/json; charset=utf-8 ' );
552+ Recorder::$ input = static ::$ mf2 ;
553+ Recorder::$ input ['properties ' ]['location-visibility ' ] = array ( 'private ' );
554+ $ post = self ::check_create ();
555+ $ this ->assertEquals ( 0 , get_post_meta ( $ post ->ID , 'geo_public ' , true ) );
556+
557+ }
558+
559+ function test_create_location_visibility_public () {
560+ Recorder::$ request_headers = array ( 'content-type ' => 'application/json; charset=utf-8 ' );
561+ Recorder::$ input = static ::$ mf2 ;
562+ Recorder::$ input ['properties ' ]['location-visibility ' ] = array ( 'public ' );
563+ $ post = self ::check_create ();
564+ $ this ->assertEquals ( 1 , get_post_meta ( $ post ->ID , 'geo_public ' , true ) );
565+
566+ }
567+
568+ function test_create_location_visibility_unsupported () {
569+ Recorder::$ request_headers = array ( 'content-type ' => 'application/json; charset=utf-8 ' );
570+ Recorder::$ input = static ::$ mf2 ;
571+ Recorder::$ input ['properties ' ]['location-visibility ' ] = array ( 'bleh ' );
572+ $ this ->check ( 400 , 'unsupported location visibility bleh ' ) ;
573+ }
574+
575+
576+ function test_create_location_visibility_none () {
577+ Recorder::$ request_headers = array ( 'content-type ' => 'application/json; charset=utf-8 ' );
578+ Recorder::$ input = static ::$ mf2 ;
579+ $ post = self ::check_create ();
580+ $ this ->assertEquals ( '' , get_post_meta ( $ post ->ID , 'geo_public ' , true ) );
581+
582+ }
583+
584+
539585 // checkin isn't a standard mf2 property yet, but OwnYourSwarm uses it.
540586 // https://ownyourswarm.p3k.io/docs#checkins
541587 function test_create_checkin () {
0 commit comments