pageOnFront.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. require_once dirname( dirname( __FILE__ ) ) . '/canonical.php';
  3. /**
  4. * @group canonical
  5. * @group rewrite
  6. * @group query
  7. */
  8. class Tests_Canonical_PageOnFront extends Tests_Canonical {
  9. function setUp() {
  10. parent::setUp();
  11. global $wp_rewrite;
  12. update_option( 'show_on_front', 'page' );
  13. update_option( 'page_for_posts', $this->factory->post->create( array( 'post_title' => 'blog-page', 'post_type' => 'page' ) ) );
  14. update_option( 'page_on_front', $this->factory->post->create( array( 'post_title' => 'front-page', 'post_type' => 'page' ) ) );
  15. $wp_rewrite->init();
  16. flush_rewrite_rules();
  17. }
  18. function data() {
  19. /* Format:
  20. * [0]: $test_url,
  21. * [1]: expected results: Any of the following can be used
  22. * array( 'url': expected redirection location, 'qv': expected query vars to be set via the rewrite AND $_GET );
  23. * array( expected query vars to be set, same as 'qv' above )
  24. * (string) expected redirect location
  25. * [3]: (optional) The ticket the test refers to, Can be skipped if unknown.
  26. */
  27. return array(
  28. // Check against an odd redirect
  29. array( '/page/2/', '/page/2/', 20385 ),
  30. // The page designated as the front page should redirect to the front of the site
  31. array( '/front-page/', '/' ),
  32. array( '/blog-page/?paged=2', '/blog-page/page/2/' ),
  33. );
  34. }
  35. }