Make WordPress Core


Ignore:
Timestamp:
10/17/2015 07:24:20 PM (9 years ago)
Author:
wonderboymusic
Message:

Unit Tests: WP_UnitTest_Generator_Sequence needs a static incrementer - otherwise, it assumes every test class is a reset, which it no longer is (it is now static).

While we're at it, remove unnecessary tearDown() code.

See #30017, #33968.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/includes/factory.php

    r34855 r35244  
    402402
    403403class WP_UnitTest_Generator_Sequence {
    404     var $next;
    405     var $template_string;
    406 
    407     function __construct( $template_string = '%s', $start = 1 ) {
    408         $this->next = $start;
     404    static $incr = -1;
     405    public $next;
     406    public $template_string;
     407
     408    function __construct( $template_string = '%s', $start = null ) {
     409        if ( $start ) {
     410            $this->next = $start;
     411        } else {
     412            self::$incr++;
     413            $this->next = self::$incr;
     414        }
    409415        $this->template_string = $template_string;
    410416    }
Note: See TracChangeset for help on using the changeset viewer.