| 120 | |
| 121 | /** |
| 122 | * @ticket 28517 |
| 123 | */ |
| 124 | function test_flush_rules_hard_true_no_filters() { |
| 125 | // hard true - filter false |
| 126 | $actual = $GLOBALS['wp_rewrite']->flush_rules( true ); |
| 127 | $this->assertEquals( $actual, 'hard' ); |
| 128 | } |
| 129 | |
| 130 | /** |
| 131 | * @ticket 28517 |
| 132 | */ |
| 133 | function test_flush_rules_hard_false_no_filters() { |
| 134 | // hard false - filter false |
| 135 | $actual = $GLOBALS['wp_rewrite']->flush_rules( false ); |
| 136 | $this->assertEquals( $actual, 'soft' ); |
| 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->assertEquals( $actual, 'hard' ); |
| 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->assertEquals( $actual, 'hard' ); |
| 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->assertEquals( $actual, 'hard' ); |
| 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->assertEquals( $actual, 'soft' ); |
| 185 | } |