Changeset 44916
- Timestamp:
- 03/15/2019 10:13:30 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/includes/abstract-testcase.php
r44904 r44916 388 388 */ 389 389 public function _create_temporary_tables( $query ) { 390 if ( 'CREATE TABLE' === substr( trim( $query ), 0, 12) ) {390 if ( 0 === strpos( trim( $query ), 'CREATE TABLE' ) ) { 391 391 return substr_replace( trim( $query ), 'CREATE TEMPORARY TABLE', 0, 12 ); 392 392 } … … 401 401 */ 402 402 public function _drop_temporary_tables( $query ) { 403 if ( 'DROP TABLE' === substr( trim( $query ), 0, 10) ) {403 if ( 0 === strpos( trim( $query ), 'DROP TABLE' ) ) { 404 404 return substr_replace( trim( $query ), 'DROP TEMPORARY TABLE', 0, 10 ); 405 405 } … … 512 512 */ 513 513 public function setExpectedDeprecated( $deprecated ) { 514 array_push( $this->expected_deprecated, $deprecated );514 $this->expected_deprecated[] = $deprecated; 515 515 } 516 516 … … 524 524 */ 525 525 public function setExpectedIncorrectUsage( $doing_it_wrong ) { 526 array_push( $this->expected_doing_it_wrong, $doing_it_wrong );526 $this->expected_doing_it_wrong[] = $doing_it_wrong; 527 527 } 528 528 … … 554 554 */ 555 555 public function deprecated_function_run( $function ) { 556 if ( ! in_array( $function, $this->caught_deprecated ) ) {556 if ( ! in_array( $function, $this->caught_deprecated, true ) ) { 557 557 $this->caught_deprecated[] = $function; 558 558 } … … 565 565 */ 566 566 public function doing_it_wrong_run( $function ) { 567 if ( ! in_array( $function, $this->caught_doing_it_wrong ) ) {567 if ( ! in_array( $function, $this->caught_doing_it_wrong, true ) ) { 568 568 $this->caught_doing_it_wrong[] = $function; 569 569 } … … 587 587 */ 588 588 public function assertNotWPError( $actual, $message = '' ) { 589 if ( is_wp_error( $actual ) && '' === $message) {589 if ( '' === $message && is_wp_error( $actual ) ) { 590 590 $message = $actual->get_error_message(); 591 591 } … … 625 625 public function assertEqualFields( $object, $fields ) { 626 626 foreach ( $fields as $field_name => $field_value ) { 627 if ( $object->$field_name != $field_value ) {627 if ( $object->$field_name !== $field_value ) { 628 628 $this->fail(); 629 629 } … … 789 789 if ( is_numeric( $ticket ) ) { 790 790 $this->knownWPBug( $ticket ); 791 } elseif ( 'Plugin' == substr( $ticket, 0, 6) ) {791 } elseif ( 0 === strpos( $ticket, 'Plugin' ) ) { 792 792 $ticket = substr( $ticket, 6 ); 793 793 if ( $ticket && is_numeric( $ticket ) ) { … … 806 806 */ 807 807 public function knownWPBug( $ticket_id ) { 808 if ( WP_TESTS_FORCE_KNOWN_BUGS || in_array( $ticket_id, self::$forced_tickets ) ) {808 if ( WP_TESTS_FORCE_KNOWN_BUGS || in_array( $ticket_id, self::$forced_tickets, true ) ) { 809 809 return; 810 810 } … … 835 835 */ 836 836 public function knownPluginBug( $ticket_id ) { 837 if ( WP_TESTS_FORCE_KNOWN_BUGS || in_array( 'Plugin' . $ticket_id, self::$forced_tickets ) ) {837 if ( WP_TESTS_FORCE_KNOWN_BUGS || in_array( 'Plugin' . $ticket_id, self::$forced_tickets, true ) ) { 838 838 return; 839 839 } … … 951 951 $result = is_callable( $query_thing ) ? call_user_func( $query_thing ) : $wp_query->$query_thing; 952 952 953 if ( in_array( $query_thing, $true ) ) {953 if ( in_array( $query_thing, $true, true ) ) { 954 954 if ( ! $result ) { 955 955 $message .= $query_thing . ' is false but is expected to be true. ' . PHP_EOL; … … 976 976 public function unlink( $file ) { 977 977 $exists = is_file( $file ); 978 if ( $exists && ! in_array( $file, self::$ignore_files ) ) {978 if ( $exists && ! in_array( $file, self::$ignore_files, true ) ) { 979 979 //error_log( $file ); 980 980 unlink( $file ); … … 994 994 $files = $this->files_in_dir( $path ); 995 995 foreach ( $files as $file ) { 996 if ( ! in_array( $file, self::$ignore_files ) ) {996 if ( ! in_array( $file, self::$ignore_files, true ) ) { 997 997 $this->unlink( $file ); 998 998 } … … 1117 1117 if ( is_multisite() ) { 1118 1118 return wpmu_delete_user( $user_id ); 1119 } else {1120 return wp_delete_user( $user_id ); 1121 }1119 } 1120 1121 return wp_delete_user( $user_id ); 1122 1122 } 1123 1123
Note: See TracChangeset
for help on using the changeset viewer.