| | 142 | |
| | 143 | /** |
| | 144 | * Tests to see if the pre_get_posts filter causes PHP notices when run on a static front page. |
| | 145 | * @ticket 21790 |
| | 146 | */ |
| | 147 | function test_static_front_page_pre_get_posts() { |
| | 148 | add_filter( 'pre_get_posts', array( $this, 'filter_static_front_page_pre_get_posts' ) ); |
| | 149 | $page_one = $this->factory->post->create( array( 'post_type' => 'page' ) ); |
| | 150 | $page_two = $this->factory->post->create( array( 'post_type' => 'page' ) ); |
| | 151 | update_option( 'show_on_front', 'page' ); |
| | 152 | update_option( 'page_on_front', $page_one ); |
| | 153 | $this->go_to( home_url() ); |
| | 154 | $this->assertFalse( $this->test_error, 'PHP Notices on front page.' ); |
| | 155 | |
| | 156 | // Run same test on page that is not set as front page. |
| | 157 | $this->test_error = false; |
| | 158 | $this->go_to( get_permalink( $page_two ) ); |
| | 159 | $this->assertFalse( $this->test_error, 'PHP Notices on another page.' ); |