- Timestamp:
- 04/20/2020 10:28:17 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/api.wordpress.org/public_html/events/1.0/tests/test-index.php
r9641 r9749 26 26 $tests_failed += test_build_response(); 27 27 $tests_failed += test_is_client_core(); 28 $tests_failed += test_get_iso_3166_2_country_codes(); 28 29 29 30 $query_count = count( $wpdb->queries ); … … 1182 1183 'us' => array( 1183 1184 'promo_start' => strtotime( '2019-08-16 00:00:00' ), 1184 'regional_countries' => array( 1185 'us', 'ca', 'bz', 'cr', 'sv', 'gt', 'hn', 'mx', 'ni', 'pa', 1186 'ar', 'bo', 'br', 'cl', 'co', 'ec', 'gf', 'gy', 'py', 'pe', 1187 'sr', 'uy', 've', 'ag', 'aw', 'bs', 'bb', 'ky', 'cu', 'dm', 1188 'do', 'gd', 'ht', 'jm', 'kn', 'lc', 'vc', 'tt', 1185 1186 'regional_countries' => array_merge( 1187 get_iso_3166_2_country_codes( 'south america' ), 1188 get_iso_3166_2_country_codes( 'north america' ) 1189 1189 ), 1190 1190 'event' => array( … … 1448 1448 1449 1449 /** 1450 * Test `get_iso_3166_2_country_codes()`. 1451 */ 1452 function test_get_iso_3166_2_country_codes() { 1453 $failed = 0; 1454 $cases = array( 1455 'antarctica' => 'HM', 1456 'africa' => 'KM', 1457 'asia' => 'SA', 1458 'europe' => 'IM', 1459 'north america' => 'MQ', 1460 'oceania' => 'MP', 1461 'south america' => 'GY', 1462 ); 1463 1464 printf( "\n\nRunning %d get_iso_3166_2_country_codes() tests\n", count( $cases ) ); 1465 1466 foreach ( $cases as $continent => $sample_country ) { 1467 $countries = get_iso_3166_2_country_codes( $continent ); 1468 1469 $expected_result = true; 1470 $actual_result = in_array( $sample_country, $countries, true ); 1471 $passed = $expected_result === $actual_result; 1472 1473 output_results( $continent, $passed, $expected_result, $actual_result ); 1474 1475 if ( ! $passed ) { 1476 $failed++; 1477 } 1478 } 1479 1480 return $failed; 1481 } 1482 1483 /** 1450 1484 * Stub to simulate cache misses, so that the tests always get fresh results 1451 1485 *
Note: See TracChangeset
for help on using the changeset viewer.