Make WordPress Core

Changeset 36254


Ignore:
Timestamp:
01/10/2016 07:01:13 PM (9 years ago)
Author:
swissspidy
Message:

Rewrite: Ensure WP_Rewrite::flush_rules() does not delete the 'rewrite_rules' option.

Instead, the option gets updated to an empty string.
Adds unit tests.

Props SergeyBiryukov, jesin, voldemortensen.
Fixes #29107.

File:
1 edited

Legend:

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

    r35256 r36254  
    321321    }
    322322
     323    /**
     324     * @ticket 29107
     325     */
     326    public function test_flush_rules_does_not_delete_option() {
     327        $this->set_permalink_structure();
     328
     329        $rewrite_rules = get_option( 'rewrite_rules' );
     330        $this->assertSame( '', $rewrite_rules );
     331
     332        $this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
     333
     334        $rewrite_rules = get_option( 'rewrite_rules' );
     335        $this->assertInternalType( 'array', $rewrite_rules );
     336        $this->assertNotEmpty( $rewrite_rules );
     337    }
    323338}
Note: See TracChangeset for help on using the changeset viewer.