Making WordPress.org


Ignore:
Timestamp:
12/14/2017 11:45:18 PM (7 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

    r6275 r6276  
    1212function run_tests() {
    1313    global $wpdb;
     14
    1415    define( 'RUNNING_TESTS', true );
    1516    define( 'SAVEQUERIES',   true );
     
    2324    $tests_failed += test_build_response();
    2425    $tests_failed += test_is_client_core();
     26
    2527    $query_count  = count( $wpdb->queries );
    2628    $query_time   = array_sum( array_column( $wpdb->queries, 1 ) );
     
    98100        }
    99101
    100         $passed      = $case['expected'] === $actual_result;
     102        $passed = $case['expected'] === $actual_result;
    101103
    102104        output_results( $case_id, $passed, $case['expected'], $actual_result );
     
    116118 */
    117119function get_location_test_cases() {
    118      $cases = array(
     120    $cases = array(
    119121        /*
    120122         * Only the country code is given
     
    140142            ),
    141143            'expected' => array(
    142                 'country' => 'ID',
     144                'country'     => 'ID',
    143145                'description' => 'indonesia',
    144146            ),
     
    388390         * "Yaoundé", but it's correct in the database itself.
    389391         */
    390          'city-endonym-accents-africa' => array(
     392        'city-endonym-accents-africa' => array(
    391393            'input' => array(
    392394                'location_name' => 'Yaoundé',
     
    641643            ),
    642644            'expected' => array(
    643                 'country' => 'CA',
     645                'country'     => 'CA',
    644646                'description' => 'canada',
    645647            ),
     
    653655            ),
    654656            'expected' => array(
    655                 'country' => 'DO',
     657                'country'     => 'DO',
    656658                'description' => 'dominican republic',
    657659            ),
     
    665667            ),
    666668            'expected' => array(
    667                 'country' => 'CF',
     669                'country'     => 'CF',
    668670                'description' => 'central african republic',
    669671            ),
     
    677679            ),
    678680            'expected' => array(
    679                 'country' => 'GB',
     681                'country'     => 'GB',
    680682                'description' => 'united kingdom',
    681683            ),
     
    689691            ),
    690692            'expected' => array(
    691                 'country' => 'BI',
     693                'country'     => 'BI',
    692694                'description' => 'burundi',
    693695            ),
     
    890892
    891893        $passed = $case['expected']['count'] === count( $actual_result ) &&
    892             ! empty( $actual_result[0]['url'] ) &&
    893             strtotime( $actual_result[0]['date'] ) > time() - ( 2 * 24 * 60 * 60 ) &&
    894             $case['expected']['country'] === strtoupper( $actual_result[0]['location']['country'] );
     894                  ! empty( $actual_result[0]['url'] ) &&
     895                  strtotime( $actual_result[0]['date'] ) > time() - ( 2 * 24 * 60 * 60 ) &&
     896                  $case['expected']['country'] === strtoupper( $actual_result[0]['location']['country'] );
    895897
    896898        output_results( $case_id, $passed, $case['expected'], $actual_result );
     
    928930        '1-in-australia' => array(
    929931            'input' => array(
    930                 'number' => '1',
     932                'number'  => '1',
    931933                'country' => 'AU',
    932934            ),
     
    958960        $actual_result = build_response( $case['input']['location'], $case['input']['location_args'] );
    959961
    960         $passed = $case['expected']['location'] === $actual_result['location'] &&
    961             isset( $case['expected']['error'] ) === isset( $actual_result['error'] );
     962        $passed = $case['expected']['location']       === $actual_result['location'] &&
     963                  isset( $case['expected']['error'] ) === isset( $actual_result['error'] );
    962964
    963965        if ( $passed && $case['expected']['events'] ) {
    964966            $passed = ! empty( $actual_result['events'] ) &&
    965                 ! empty( $actual_result['events'][0]['url'] ) &&
    966                 strtotime( $actual_result['events'][0]['date'] ) > time() - ( 2 * 24 * 60 * 60 );
     967                      ! empty( $actual_result['events'][0]['url'] ) &&
     968                      strtotime( $actual_result['events'][0]['date'] ) > time() - ( 2 * 24 * 60 * 60 );
    967969        }
    968970
     
    10631065    foreach ( $cases as $user_agent => $expected_result ) {
    10641066        $actual_result = is_client_core( $user_agent );
    1065 
    1066         $passed = $expected_result === $actual_result;
     1067        $passed        = $expected_result === $actual_result;
    10671068
    10681069        output_results( $user_agent, $passed, $expected_result, $actual_result );
Note: See TracChangeset for help on using the changeset viewer.