Changeset 46127 for trunk/tests/phpunit/includes/abstract-testcase.php
- Timestamp:
- 09/15/2019 11:03:45 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/includes/abstract-testcase.php
r45588 r46127 904 904 * 905 905 * Any properties that are listed by name as parameters will be expected to be true; all others are 906 * expected to be false. For example, assertQueryTrue( 'is_single', 'is_feed') means is_single()906 * expected to be false. For example, assertQueryTrue( 'is_single', 'is_feed' ) means is_single() 907 907 * and is_feed() must be true and everything else must be false to pass. 908 908 * … … 912 912 * @param string ...$prop Any number of WP_Query properties that are expected to be true for the current request. 913 913 */ 914 public function assertQueryTrue( ) {914 public function assertQueryTrue( ...$prop ) { 915 915 global $wp_query; 916 $all = array( 916 917 $all = array( 917 918 'is_404', 918 919 'is_admin', … … 945 946 'is_year', 946 947 ); 947 $true = func_get_args(); 948 949 foreach ( $true as $true_thing ) { 948 949 foreach ( $prop as $true_thing ) { 950 950 $this->assertContains( $true_thing, $all, "Unknown conditional: {$true_thing}." ); 951 951 } … … 957 957 $result = is_callable( $query_thing ) ? call_user_func( $query_thing ) : $wp_query->$query_thing; 958 958 959 if ( in_array( $query_thing, $ true, true ) ) {959 if ( in_array( $query_thing, $prop, true ) ) { 960 960 if ( ! $result ) { 961 961 $message .= $query_thing . ' is false but is expected to be true. ' . PHP_EOL;
Note: See TracChangeset
for help on using the changeset viewer.