Making WordPress.org

Changeset 5066


Ignore:
Timestamp:
03/03/2017 09:20:12 PM (9 years ago)
Author:
iandunn
Message:

Events API: Add tests for city endonyms

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/api.wordpress.org/public_html/events/1.0/tests/test-index.php

    r5065 r5066  
    124124
    125125                /*
    126                  * The city, locale, and timezone are given
     126                 * The English city exonym, locale, and timezone are given
    127127                 */
    128128                'city-africa' => array(
     
    212212
    213213                /*
     214                 * The city endonym, locale, and timezone are given
     215                 *
     216                 * @todo
     217                 * This is currently failling. A query from PHP shows row id 2220957 has "Yaound?" instead of
     218                 * "Yaoundé", but it's correct in the database itself.
     219                 */
     220                 'city-endonym-accents-africa' => array(
     221                        'input' => array(
     222                                'location_name' => 'Yaoundé',
     223                                'locale'        => 'fr_FR',
     224                                'timezone'      => 'Africa/Douala',
     225                        ),
     226                        'expected' => array(
     227                                'description' => 'yaoundé',
     228                                'latitude'    => '3.867',
     229                                'longitude'   => '11.517',
     230                                'country'     => 'CM',
     231                        ),
     232                ),
     233
     234                'city-endonym-non-latin-africa' => array(
     235                        'input' => array(
     236                                'location_name' => 'አዲስ አበ',
     237                                'locale'        => 'am',
     238                                'timezone'      => 'Africa/Addis_Ababa',
     239                        ),
     240                        'expected' => array(
     241                                'description' => 'addis ababa',
     242                                'latitude'    => '9.025',
     243                                'longitude'   => '38.747',
     244                                'country'     => 'ET',
     245                        ),
     246                ),
     247
     248                'city-endonym-non-latin-length-greater-than-4-asia' => array(
     249                        'input' => array(
     250                                'location_name' => '白浜町宇佐崎南',
     251                                'locale'        => 'ja',
     252                                'timezone'      => 'Asia/Tokyo',
     253                        ),
     254                        'expected' => array(
     255                                'description' => 'shirahamachō-usazakiminami',
     256                                'latitude'    => '34.783',
     257                                'longitude'   => '134.717',
     258                                'country'     => 'JP',
     259                        ),
     260                ),
     261
     262                /*
     263                 * @todo
     264                 *
     265                 * This is currently failing, but should pass. It looks like the value is in row 112931.
     266                 */
     267                'city-endonym-non-latin-length-greater-than-4-asia2' => array(
     268                        'input' => array(
     269                                'location_name' => 'تهران',
     270                                'locale'        => 'fa_IR',
     271                                'timezone'      => 'Asia/Tehran',
     272                        ),
     273                        'expected' => array(
     274                                'description' => 'tehran',
     275                                'latitude'    => '35.694',
     276                                'longitude'   => '51.422',
     277                                'country'     => 'IR',
     278                        ),
     279                ),
     280
     281                /*
     282                 * @todo
     283                 *
     284                 * This is currently failing, but should pass. It looks like the value is in row 1174872
     285                 */
     286                'city-endonym-non-latin-length-greater-than-4-asia3' => array(
     287                        'input' => array(
     288                                'location_name' => 'كراچى',
     289                                'locale'        => 'ur',
     290                                'timezone'      => 'Asia/Karachi',
     291                        ),
     292                        'expected' => array(
     293                                'description' => 'karachi',
     294                                'latitude'    => '24.906',
     295                                'longitude'   => '67.082',
     296                                'country'     => 'TR',
     297                        ),
     298                ),
     299
     300                /*
     301                 * @todo
     302                 *
     303                 * This is currently failing, but it should pass. One reason it may be failing is that `ft_min_word_len`
     304                 * is set to `4` and `東京` is only `2`.
     305                 *
     306                 * But, there are others that are failing that are >= 4, though, like `シラオカ`, `しらおか`, `Ширахама`, and
     307                 *`すぎと,スギト`. So, there may be additional reasons too.
     308                 */
     309                'city-endonym-non-latin-length-less-than-4-asia' => array(
     310                        'input' => array(
     311                                'location_name' => '東京',
     312                                'locale'        => 'ja',
     313                                'timezone'      => 'Asia/Tokyo',
     314                        ),
     315                        'expected' => array(
     316                                'description' => 'tokyo',
     317                                'latitude'    => '35.690',
     318                                'longitude'   => '139.692',
     319                                'country'     => 'JP',
     320                        ),
     321                ),
     322
     323                'city-endonym-europe' => array(
     324                        'input' => array(
     325                                'location_name' => 'Wien',
     326                                'locale'        => 'de_DE',
     327                                'timezone'      => 'Europe/Berlin',
     328                        ),
     329                        'expected' => array(
     330                                'description' => 'vienna',
     331                                'latitude'    => '48.208',
     332                                'longitude'   => '16.372',
     333                                'country'     => 'AT',
     334                        ),
     335                ),
     336
     337                'city-endonym-europe2' => array(
     338                        'input' => array(
     339                                'location_name' => 'Москва',
     340                                'locale'        => 'ru_RU',
     341                                'timezone'      => 'Europe/Moscow',
     342                        ),
     343                        'expected' => array(
     344                                'description' => 'moscow',
     345                                'latitude'    => '55.752',
     346                                'longitude'   => '37.616',
     347                                'country'     => 'RU',
     348                        ),
     349                ),
     350
     351                'city-endonym-accents-north-america' => array(
     352                        'input' => array(
     353                                'location_name' => 'Ciudad de México',
     354                                'locale'        => 'en_MX',
     355                                'timezone'      => 'America/Mexico_City',
     356                        ),
     357                        'expected' => array(
     358                                'description' => 'mexico city',
     359                                'latitude'    => '19.428',
     360                                'longitude'   => '-99.128',
     361                                'country'     => 'MX',
     362                        ),
     363                ),
     364
     365                'city-endonym-accents-oceania' => array(
     366                        'input' => array(
     367                                'location_name' => 'Hagåtña',
     368                                'locale'        => 'en_US',
     369                                'timezone'      => 'Pacific/Guam',
     370                        ),
     371                        'expected' => array(
     372                                'description' => 'hagåtña',
     373                                'latitude'    => '13.476',
     374                                'longitude'   => '144.749',
     375                                'country'     => 'GU',
     376                        ),
     377                ),
     378
     379                'city-endonym-south-america' => array(
     380                        'input' => array(
     381                                'location_name' => 'Bogotá',
     382                                'locale'        => 'es_CO',
     383                                'timezone'      => 'America/Bogota',
     384                        ),
     385                        'expected' => array(
     386                                'description' => 'bogotá',
     387                                'latitude'    => '4.610',
     388                                'longitude'   => '-74.082',
     389                                'country'     => 'CO',
     390                        ),
     391                ),
     392
     393
     394                /*
    214395                 * Only the IP is given
    215396                 */
Note: See TracChangeset for help on using the changeset viewer.