Make WordPress Core

Ticket #29107: 29107-tests.diff

File 29107-tests.diff, 730 bytes (added by jesin, 11 years ago)

Tests if rewrite_rules is an array and is not empty

  • tests/phpunit/tests/rewrite.php

     
    120120
    121121                restore_current_blog();
    122122        }
    123 }
    124  No newline at end of file
     123
     124        /**
     125         * @ticket 29107
     126         */
     127        function test_rewrite_rules_option_nonempty() {
     128                global $wp_rewrite;
     129
     130                $wp_rewrite->set_permalink_structure( '' );
     131                $wp_rewrite->flush_rules();
     132                $wp_rewrite->set_permalink_structure( '/%postname%/' );
     133                $wp_rewrite->flush_rules();
     134
     135                $rewrite_rules = get_option( 'rewrite_rules' );
     136
     137                $this->assertTrue( is_array( $rewrite_rules ) );
     138                $this->assertNotEmpty( $rewrite_rules );
     139        }
     140}