Ticket #28487: 28487.2.diff
File 28487.2.diff, 1.4 KB (added by , 11 years ago) |
---|
-
src/wp-includes/functions.php
3360 3360 } 3361 3361 3362 3362 /** 3363 * Determine if the scheme of the given URL is https. 3364 * 3365 * @since 4.0.0 3366 * 3367 * @param string $url The URL 3368 * @return boolean True if the given URL uses https, false if not (or if the URL is not valid). 3369 */ 3370 function is_https_url( $url ) { 3371 return ( 'https' === parse_url( $url, PHP_URL_SCHEME ) ); 3372 } 3373 3374 /** 3363 3375 * Whether SSL login should be forced. 3364 3376 * 3365 3377 * @since 2.6.0 -
tests/phpunit/tests/functions/isHttpsUrl.php
1 <?php 2 3 /** 4 * Test is_https_url(). 5 * 6 * @group functions.php 7 * @ticket 28487 8 */ 9 class Tests_Functions_IsHttpsUrl extends WP_UnitTestCase { 10 11 function test_is_https_url() { 12 13 $this->assertTrue( is_https_url( 'https://example.com/' ) ); 14 $this->assertTrue( is_https_url( 'https://localhost/' ) ); 15 16 $this->assertFalse( is_https_url( 'http://example.com' ) ); 17 $this->assertFalse( is_https_url( 'Hello World!' ) ); 18 $this->assertFalse( is_https_url( 'httpsinvalid' ) ); 19 20 } 21 22 }