Make WordPress Core

Changeset 51196


Ignore:
Timestamp:
06/22/2021 04:34:29 AM (3 years ago)
Author:
SergeyBiryukov
Message:

Tests: Use more appropriate assertions in a few tests.

Follow-up to [34804], [41376], [50959], [51124].

See #52625.

Location:
trunk/tests/phpunit/tests
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/customize/custom-css-setting.php

    r50450 r51196  
    381381        $unclosed_comment = $basic_css . '</style>';
    382382        $result           = $this->setting->validate( $unclosed_comment );
    383         $this->assertTrue( array_key_exists( 'illegal_markup', $result->errors ) );
     383        $this->assertArrayHasKey( 'illegal_markup', $result->errors );
    384384    }
    385385}
  • trunk/tests/phpunit/tests/post/revisions.php

    r51138 r51196  
    624624            }
    625625        );
     626
    626627        $this->assertSame( $generic, wp_revisions_to_keep( $post ) );
    627628
     
    634635            }
    635636        );
     637
    636638        $this->assertSame( $expected, wp_revisions_to_keep( $post ) );
    637639    }
     
    643645     */
    644646    public function test_wp_save_post_revision_error() {
    645         $post     = self::factory()->post->create_and_get(
     647        $post = self::factory()->post->create_and_get(
    646648            array(
    647649                'ID' => PHP_INT_MAX,
    648650            )
    649651        );
     652
    650653        $revision = _wp_put_post_revision( $post );
    651         $this->assertTrue( is_wp_error( $revision ) );
     654
     655        $this->assertWPError( $revision );
    652656    }
    653657}
  • trunk/tests/phpunit/tests/theme/wpThemeJsonResolver.php

    r51149 r51196  
    158158        $fse = WP_Theme_JSON_Resolver::theme_has_support();
    159159
    160         $this->assertSame( false, $default );
    161         $this->assertSame( true, $fse );
     160        $this->assertFalse( $default );
     161        $this->assertTrue( $fse );
    162162    }
    163163
  • trunk/tests/phpunit/tests/user/query.php

    r49603 r51196  
    12971297
    12981298        foreach ( $query_vars as $query_var ) {
    1299             $this->assertTrue( array_key_exists( $query_var, $q->query_vars ), "$query_var does not exist." );
     1299            $this->assertArrayHasKey( $query_var, $q->query_vars, "$query_var does not exist." );
    13001300        }
    13011301
Note: See TracChangeset for help on using the changeset viewer.