Make WordPress Core


Ignore:
Timestamp:
12/19/2021 01:42:37 PM (2 years ago)
Author:
johnbillion
Message:

Build/Test Tools: Reduce the use of unnecessary randomness in tests.

This increases the overall reliability of the tests.

Props johnillo

Fixes #37371

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/term.php

    r52010 r52389  
    5252    public function test_is_term_type() {
    5353        // Insert a term.
    54         $term = rand_str();
     54        $term = 'term_new';
    5555        $t    = wp_insert_term( $term, $this->taxonomy );
    5656        $this->assertIsArray( $t );
    5757        $term_obj = get_term_by( 'name', $term, $this->taxonomy );
    58         $this->assertEquals( $t['term_id'], term_exists( $term_obj->slug ) );
    59 
     58
     59        $exists = term_exists( $term_obj->slug );
    6060        // Clean up.
    61         $this->assertTrue( wp_delete_term( $t['term_id'], $this->taxonomy ) );
     61        $deleted = wp_delete_term( $t['term_id'], $this->taxonomy );
     62
     63        $this->assertEquals( $t['term_id'], $exists );
     64        $this->assertTrue( $deleted );
    6265    }
    6366
Note: See TracChangeset for help on using the changeset viewer.