- Timestamp:
- 12/03/2017 05:28:28 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/api.wordpress.org/public_html/events/1.0/tests/test-index.php
r6180 r6208 22 22 $tests_failed += test_add_regional_wordcamps(); 23 23 $tests_failed += test_build_response(); 24 $tests_failed += test_is_client_core(); 24 25 $query_count = count( $wpdb->queries ); 25 26 $query_time = array_sum( array_column( $wpdb->queries, 1 ) ); … … 1021 1022 1022 1023 /** 1024 * Test `is_client_core()`. 1025 * 1026 * @return int 1027 */ 1028 function test_is_client_core() { 1029 $failed = 0; 1030 $cases = array( 1031 '' => false, 1032 'Contains WordPress but no slash' => false, 1033 'WordPress/4.9; https://example.org' => true, 1034 'WordPress/10.0' => true, 1035 ); 1036 1037 printf( "\n\nRunning %d is_client_core() tests\n", count( $cases ) ); 1038 1039 foreach ( $cases as $user_agent => $expected_result ) { 1040 $actual_result = is_client_core( $user_agent ); 1041 1042 $passed = $expected_result === $actual_result; 1043 1044 output_results( $user_agent, $passed, $expected_result, $actual_result ); 1045 1046 if ( ! $passed ) { 1047 $failed++; 1048 } 1049 } 1050 1051 return $failed; 1052 } 1053 1054 /** 1023 1055 * Test `add_regional_events()` 1024 1056 *
Note: See TracChangeset
for help on using the changeset viewer.