- Timestamp:
- 09/16/2020 06:17:05 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/api.wordpress.org/public_html/events/1.0/tests/test-index.php
r10250 r10271 16 16 define( 'SAVEQUERIES', true ); 17 17 18 require_once ( dirname( __DIR__ ) . '/index.php' );19 20 $tests_failed = 0;18 require_once dirname( __DIR__ ) . '/index.php'; 19 20 $tests_failed = 0; 21 21 $tests_failed += test_get_location(); 22 22 $tests_failed += test_get_events(); … … 29 29 $tests_failed += test_remove_duplicate_events(); 30 30 31 $query_count 32 $query_time 31 $query_count = count( $wpdb->queries ); 32 $query_time = array_sum( array_column( $wpdb->queries, 1 ) ); 33 33 34 34 printf( … … 184 184 ), 185 185 186 187 186 /* 188 187 * A location couldn't be found … … 191 190 'input' => array( 192 191 'location_name' => 'Rivendell', 193 'ip' => '127.0.0.1' 192 'ip' => '127.0.0.1', 194 193 ), 195 194 'expected' => false, … … 354 353 'city-with-diacritics-in-query' => array( 355 354 'input' => array( 356 'location_name' => "Doña Ana",355 'location_name' => 'Doña Ana', 357 356 'locale' => 'en_US', 358 357 'timezone' => 'America/Denver', 359 358 ), 360 359 'expected' => array( 361 'description' => "doña ana",360 'description' => 'doña ana', 362 361 'latitude' => '32.390', 363 362 'longitude' => '-106.814', … … 368 367 'city-with-diacritics-in-formal-name-but-not-in-query' => array( 369 368 'input' => array( 370 'location_name' => "Dona Ana",369 'location_name' => 'Dona Ana', 371 370 'locale' => 'en_US', 372 371 'timezone' => 'America/Denver', 373 372 ), 374 373 'expected' => array( 375 'description' => "dona ana",374 'description' => 'dona ana', 376 375 'latitude' => '32.390', 377 376 'longitude' => '-106.814', … … 382 381 'city-with-period-in-query' => array( 383 382 'input' => array( 384 'location_name' => "St. Louis",383 'location_name' => 'St. Louis', 385 384 'locale' => 'en_US', 386 385 'timezone' => 'America/Chicago', 387 386 ), 388 387 'expected' => array( 389 'description' => "st. louis",388 'description' => 'st. louis', 390 389 'latitude' => '38.627', 391 390 'longitude' => '-90.198', … … 396 395 'city-with-period-in-formal-name-but-not-in-query' => array( 397 396 'input' => array( 398 'location_name' => "St Louis",397 'location_name' => 'St Louis', 399 398 'locale' => 'en_US', 400 399 'timezone' => 'America/Chicago', 401 400 ), 402 401 'expected' => array( 403 'description' => "st louis",402 'description' => 'st louis', 404 403 'latitude' => '38.627', 405 404 'longitude' => '-90.198', … … 1496 1495 $duplicate_events = array( 1497 1496 // Each of these represents an event; extraneous fields have been removed for readability. 1498 array 1497 array( 1499 1498 'url' => 'https://2020.us.wordcamp.org/', 1500 1499 ), 1501 1500 1502 array 1501 array( 1503 1502 'url' => 'https://2020.detroit.wordcamp.org/', 1504 1503 ), … … 1507 1506 // Intentionally missing the trailing slash, to account for inconsistencies in data. 1508 1507 'url' => 'https://2020.us.wordcamp.org', 1509 ) 1508 ), 1510 1509 ); 1511 1510 … … 1513 1512 1514 1513 $expected_result = array( 1515 array 1514 array( 1516 1515 'url' => 'https://2020.us.wordcamp.org', 1517 1516 ), 1518 1517 1519 array 1518 array( 1520 1519 'url' => 'https://2020.detroit.wordcamp.org/', 1521 1520 ), 1522 1521 ); 1523 1522 1524 $actual_result 1525 $passed 1523 $actual_result = remove_duplicate_events( $duplicate_events ); 1524 $passed = $expected_result === $actual_result; 1526 1525 1527 1526 output_results( 'remove duplicate events', $passed, $expected_result, $actual_result );
Note: See TracChangeset
for help on using the changeset viewer.