Making WordPress.org


Ignore:
Timestamp:
09/16/2020 06:17:05 PM (4 years ago)
Author:
iandunn
Message:

Events: Apply coding standards.

File:
1 edited

Legend:

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

    r10250 r10271  
    1616    define( 'SAVEQUERIES',   true );
    1717
    18     require_once( dirname( __DIR__ ) . '/index.php' );
    19 
    20     $tests_failed = 0;
     18    require_once dirname( __DIR__ ) . '/index.php';
     19
     20    $tests_failed  = 0;
    2121    $tests_failed += test_get_location();
    2222    $tests_failed += test_get_events();
     
    2929    $tests_failed += test_remove_duplicate_events();
    3030
    31     $query_count  = count( $wpdb->queries );
    32     $query_time   = array_sum( array_column( $wpdb->queries, 1 ) );
     31    $query_count = count( $wpdb->queries );
     32    $query_time  = array_sum( array_column( $wpdb->queries, 1 ) );
    3333
    3434    printf(
     
    184184        ),
    185185
    186 
    187186        /*
    188187         * A location couldn't be found
     
    191190            'input' => array(
    192191                'location_name' => 'Rivendell',
    193                 'ip'            => '127.0.0.1'
     192                'ip'            => '127.0.0.1',
    194193            ),
    195194            'expected' => false,
     
    354353        'city-with-diacritics-in-query' => array(
    355354            'input' => array(
    356                 'location_name' => "Doña Ana",
     355                'location_name' => 'Doña Ana',
    357356                'locale'        => 'en_US',
    358357                'timezone'      => 'America/Denver',
    359358            ),
    360359            'expected' => array(
    361                 'description' => "doña ana",
     360                'description' => 'doña ana',
    362361                'latitude'    => '32.390',
    363362                'longitude'   => '-106.814',
     
    368367        'city-with-diacritics-in-formal-name-but-not-in-query' => array(
    369368            'input' => array(
    370                 'location_name' => "Dona Ana",
     369                'location_name' => 'Dona Ana',
    371370                'locale'        => 'en_US',
    372371                'timezone'      => 'America/Denver',
    373372            ),
    374373            'expected' => array(
    375                 'description' => "dona ana",
     374                'description' => 'dona ana',
    376375                'latitude'    => '32.390',
    377376                'longitude'   => '-106.814',
     
    382381        'city-with-period-in-query' => array(
    383382            'input' => array(
    384                 'location_name' => "St. Louis",
     383                'location_name' => 'St. Louis',
    385384                'locale'        => 'en_US',
    386385                'timezone'      => 'America/Chicago',
    387386            ),
    388387            'expected' => array(
    389                 'description' => "st. louis",
     388                'description' => 'st. louis',
    390389                'latitude'    => '38.627',
    391390                'longitude'   => '-90.198',
     
    396395        'city-with-period-in-formal-name-but-not-in-query' => array(
    397396            'input' => array(
    398                 'location_name' => "St Louis",
     397                'location_name' => 'St Louis',
    399398                'locale'        => 'en_US',
    400399                'timezone'      => 'America/Chicago',
    401400            ),
    402401            'expected' => array(
    403                 'description' => "st louis",
     402                'description' => 'st louis',
    404403                'latitude'    => '38.627',
    405404                'longitude'   => '-90.198',
     
    14961495    $duplicate_events = array(
    14971496        // Each of these represents an event; extraneous fields have been removed for readability.
    1498         array (
     1497        array(
    14991498            'url' => 'https://2020.us.wordcamp.org/',
    15001499        ),
    15011500
    1502         array (
     1501        array(
    15031502            'url' => 'https://2020.detroit.wordcamp.org/',
    15041503        ),
     
    15071506            // Intentionally missing the trailing slash, to account for inconsistencies in data.
    15081507            'url' => 'https://2020.us.wordcamp.org',
    1509         )
     1508        ),
    15101509    );
    15111510
     
    15131512
    15141513    $expected_result = array(
    1515         array (
     1514        array(
    15161515            'url' => 'https://2020.us.wordcamp.org',
    15171516        ),
    15181517
    1519         array (
     1518        array(
    15201519            'url' => 'https://2020.detroit.wordcamp.org/',
    15211520        ),
    15221521    );
    15231522
    1524     $actual_result   = remove_duplicate_events( $duplicate_events );
    1525     $passed          = $expected_result === $actual_result;
     1523    $actual_result = remove_duplicate_events( $duplicate_events );
     1524    $passed        = $expected_result === $actual_result;
    15261525
    15271526    output_results( 'remove duplicate events', $passed, $expected_result, $actual_result );
Note: See TracChangeset for help on using the changeset viewer.