| | 120 | |
| | 121 | /** |
| | 122 | * @ticket 28517 |
| | 123 | */ |
| | 124 | function test_flush_rules_hard_true_no_filters() { |
| | 125 | // hard true - no filters |
| | 126 | $actual = $GLOBALS['wp_rewrite']->flush_rules( true ); |
| | 127 | $this->assertTrue( $actual ); |
| | 128 | } |
| | 129 | |
| | 130 | /** |
| | 131 | * @ticket 28517 |
| | 132 | */ |
| | 133 | function test_flush_rules_hard_false_no_filters() { |
| | 134 | // hard false - no filters |
| | 135 | $actual = $GLOBALS['wp_rewrite']->flush_rules( false ); |
| | 136 | $this->assertFalse( $actual ); |
| | 137 | } |
| | 138 | |
| | 139 | /** |
| | 140 | * @ticket 28517 |
| | 141 | */ |
| | 142 | function test_flush_rules_hard_true_with_filters_true() { |
| | 143 | // adding a filter that returns true |
| | 144 | add_filter( 'flush_rewrite_rules_hard', function() { return true; } ); |
| | 145 | |
| | 146 | // hard true - filter true |
| | 147 | $actual = $GLOBALS['wp_rewrite']->flush_rules( true ); |
| | 148 | $this->assertTrue( $actual ); |
| | 149 | } |
| | 150 | |
| | 151 | /** |
| | 152 | * @ticket 28517 |
| | 153 | */ |
| | 154 | function test_flush_rules_hard_true_with_filters_false() { |
| | 155 | // adding a filter that returns true |
| | 156 | add_filter( 'flush_rewrite_rules_hard', function() { return false; } ); |
| | 157 | |
| | 158 | // hard true - filter true |
| | 159 | $actual = $GLOBALS['wp_rewrite']->flush_rules( true ); |
| | 160 | $this->assertFalse( $actual ); |
| | 161 | } |
| | 162 | |
| | 163 | /** |
| | 164 | * @ticket 28517 |
| | 165 | */ |
| | 166 | function test_flush_rules_hard_false_with_filters_true() { |
| | 167 | // adding a filter that returns true |
| | 168 | add_filter( 'flush_rewrite_rules_hard', function() { return true; } ); |
| | 169 | |
| | 170 | // hard false - filter true |
| | 171 | $actual = $GLOBALS['wp_rewrite']->flush_rules( false ); |
| | 172 | $this->assertTrue( $actual ); |
| | 173 | } |
| | 174 | |
| | 175 | /** |
| | 176 | * @ticket 28517 |
| | 177 | */ |
| | 178 | function test_flush_rules_hard_false_with_filters_false() { |
| | 179 | // adding a filter that returns true |
| | 180 | add_filter( 'flush_rewrite_rules_hard', function() { return false; } ); |
| | 181 | |
| | 182 | // hard false - filter false |
| | 183 | $actual = $GLOBALS['wp_rewrite']->flush_rules( false ); |
| | 184 | $this->assertFalse( $actual ); |
| | 185 | } |