WordPress.org

Make WordPress Core

Ticket #27954: 27954.3.diff

File 27954.3.diff, 2.2 KB (added by thomaswm, 4 years ago)

Corrected typo in unit tests

  • tests/phpunit/tests/canonical/forceSsl.php

    # This patch file was generated by NetBeans IDE
    # Following Index: paths are relative to: C:\Users\Thomas\Documents\NetBeansProjects\wordpress-develop
    # This patch can be applied using context Tools: Patch action on respective folder.
    # It uses platform neutral UTF-8 encoding and \n newlines.
    # Above lines and this line are ignored by the patching process.
     
     1<?php
     2
     3/**
     4 * @group canonical
     5 * @group rewrite
     6 * @group query
     7 */
     8class Tests_Canonical_Force_SSL extends WP_Canonical_UnitTestCase {
     9
     10    function setUp() {
     11        parent::setUp();
     12        define('FORCE_SSL', true);
     13
     14        $this->http  = home_url('sample-page/', 'http');
     15        $this->https = home_url('sample-page/', 'https');
     16    }
     17
     18    public function set_https($url) {
     19        return set_url_scheme($url, 'https');
     20    }
     21
     22    /**
     23     * @ticket 27954
     24     */
     25    public function test_http_request_with_http_home() {
     26        $redirect = redirect_canonical($this->http, FALSE);
     27        $this->assertEquals($redirect, $this->https);
     28    }
     29
     30    /**
     31     * @ticket 27954
     32     */
     33    public function test_https_request_with_http_home() {
     34        $redirect = redirect_canonical($this->https, FALSE);
     35        $this->assertEquals($redirect, FALSE); // No redirect
     36    }
     37
     38    /**
     39     * @ticket 27954
     40     */
     41    public function test_http_request_with_https_home() {
     42        add_filter('home_url', array($this, 'set_https'));
     43        $redirect = redirect_canonical($this->http, FALSE);
     44        $this->assertEquals($redirect, $this->https);
     45        remove_filter('home_url', array($this, 'set_https'));
     46    }
     47
     48    /**
     49     * @ticket 27954
     50     */
     51    public function test_https_request_with_https_home() {
     52        add_filter('home_url', array($this, 'set_https'));
     53        $redirect = redirect_canonical($this->https, FALSE);
     54        $this->assertEquals($redirect, FALSE); // No redirect
     55        remove_filter('home_url', array($this, 'set_https'));
     56    }
     57
     58}