WordPress.org

Make WordPress Core


Ignore:
Timestamp:
04/22/2016 02:35:52 PM (4 years ago)
Author:
boonebgorges
Message:

Tests: Use the same incrementor for all fields belonging to a given text fixture.

[35244] changed the way that WP_UnitTest_Generator_Sequence() created an
incrementor for object fields (like 'post_name' and 'user_email'), by making
incrementor static across the entire run of the test suite. While this helped
to enforce uniqueness across the tests, it has the side effect of bumping the
incrementor between fields on the same object (so that, eg, the same post might
have post_name "post-12" but post_title "Post 13". By switching to a
technique that uses the same incrementor for each field belonging to a given
fixture, we conform better to the expectations of developers using
WP_UnitTest_Factory.

Fixes #35199.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/includes/factory/class-wp-unittest-generator-sequence.php

    r36347 r37299  
    2121        return $generated;
    2222    }
     23
     24    /**
     25     * Get the incrementor.
     26     *
     27     * @since 4.6.0
     28     *
     29     * @return int
     30     */
     31    public function get_incr() {
     32        return self::$incr;
     33    }
     34
     35    /**
     36     * Get the template string.
     37     *
     38     * @since 4.6.0
     39     *
     40     * @return string
     41     */
     42    public function get_template_string() {
     43        return $this->template_string;
     44    }
    2345}
Note: See TracChangeset for help on using the changeset viewer.