https.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. /**
  3. * @group canonical
  4. * @group rewrite
  5. * @group query
  6. */
  7. class Tests_Canonical_HTTPS extends WP_Canonical_UnitTestCase {
  8. function setUp() {
  9. parent::setUp();
  10. $this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
  11. create_initial_taxonomies();
  12. $this->http = set_url_scheme( home_url( 'sample-page/' ), 'http' );
  13. $this->https = set_url_scheme( home_url( 'sample-page/' ), 'https' );
  14. }
  15. public function set_https( $url ) {
  16. return set_url_scheme( $url, 'https' );
  17. }
  18. /**
  19. * @ticket 27954
  20. */
  21. public function test_http_request_with_http_home() {
  22. $redirect = redirect_canonical( $this->http, false );
  23. $this->assertNull( $redirect );
  24. }
  25. /**
  26. * @ticket 27954
  27. */
  28. public function test_https_request_with_http_home() {
  29. $redirect = redirect_canonical( $this->https, false );
  30. $this->assertNull( $redirect );
  31. }
  32. /**
  33. * @ticket 27954
  34. */
  35. public function test_https_request_with_https_home() {
  36. add_filter( 'home_url', array( $this, 'set_https' ) );
  37. $redirect = redirect_canonical( $this->https, false );
  38. $this->assertNull( $redirect );
  39. remove_filter( 'home_url', array( $this, 'set_https' ) );
  40. }
  41. }