/**
  * @param string $list_string
  * @dataProvider provide_lists
  */
 function test_single_list($list_string)
 {
     $list = new GM_Int_List($list_string);
     $this->assertEquals($list_string, $list->expanded(), 'Expanded list is different from source.');
     $this->assertNotEmpty($list->compressed(), 'Compressed list is empty.');
     $reverse_list = new GM_Int_List($list->compressed());
     $this->assertEquals($list_string, $reverse_list->expanded(), 'Reverse expanded list is different from original.');
     $this->assertEquals($list->compressed(), $reverse_list->compressed(), 'Compressed list is different from source.');
 }
Пример #2
0
 /**
  * Retrieve any cached map data, or build it.
  * 
  * @since 1.5
  * @return array Map data for the current query.
  */
 public static function get_map_data()
 {
     $map_data = null;
     if (isset($_GET['map_data_key'])) {
         // Map data is cached in a transient
         $map_data = get_transient('gmm' . $_GET['map_data_key']);
     }
     if (!$map_data and isset($_GET['map_content'])) {
         // Try building the map data from the query string
         if (isset($_GET['oids'])) {
             if (!class_exists('GM_Int_list')) {
                 include GEO_MASHUP_DIR_PATH . '/gm-int-list.php';
             }
             $list = new GM_Int_List($_GET['oids']);
             $_GET['object_ids'] = $list->expanded();
             unset($_GET['oids']);
         }
         $map_data = GeoMashup::build_map_data($_GET);
     }
     return $map_data;
 }