Changeset 327 in tests for wp-testcase/test_link_functions.php
- Timestamp:
- 01/20/2011 02:50:29 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
wp-testcase/test_link_functions.php
r211 r327 2 2 3 3 // tests for link-template.php and related URL functions 4 5 6 4 class TestSSLLinks extends WPTestCase { 7 5 var $_old_server; … … 9 7 $this->_old_server = $_SERVER; 10 8 } 11 9 12 10 function tearDown() { 13 11 $_SERVER = $this->_old_server; 14 12 } 15 13 16 14 function test_is_ssl_positive() { 17 $this->knownWPBug(7001);18 19 15 $_SERVER['HTTPS'] = 'on'; 20 16 $this->assertTrue( is_ssl() ); 21 17 22 18 $_SERVER['HTTPS'] = 'ON'; 23 19 $this->assertTrue( is_ssl() ); 20 21 $_SERVER['HTTPS'] = '1'; 22 $this->assertTrue( is_ssl() ); 23 24 unset( $_SERVER['HTTPS'] ); 25 $_SERVER['SERVER_PORT'] = '443'; 26 $this->assertTrue( is_ssl() ); 24 27 } 25 28 26 29 function test_is_ssl_negative() { 27 $this->knownWPBug(7001);28 29 30 $_SERVER['HTTPS'] = 'off'; 30 31 $this->assertFalse( is_ssl() ); 31 32 32 33 $_SERVER['HTTPS'] = 'OFF'; 33 34 $this->assertFalse( is_ssl() ); 34 35 35 36 unset($_SERVER['HTTPS']); 36 37 $this->assertFalse( is_ssl() ); 37 38 } 38 39 39 40 function test_admin_url_valid() { 40 $this->knownWPBug(7001);41 42 $siteurl = get_option('siteurl');43 44 41 $paths = array( 45 46 47 48 49 50 51 52 42 '' => "/wp-admin/", 43 'foo' => "/wp-admin/foo", 44 '/foo' => "/wp-admin/foo", 45 '/foo/' => "/wp-admin/foo/", 46 'foo.php' => "/wp-admin/foo.php", 47 '/foo.php' => "/wp-admin/foo.php", 48 '/foo.php?bar=1' => "/wp-admin/foo.php?bar=1", 49 ); 53 50 $https = array('on', 'off'); 54 51 55 52 foreach ($https as $val) { 56 53 $_SERVER['HTTPS'] = $val; … … 58 55 if ( $val == 'on' ) 59 56 $siteurl = str_replace('http://', 'https://', $siteurl); 60 57 61 58 foreach ($paths as $in => $out) { 62 59 $this->assertEquals( $siteurl.$out, admin_url($in), "admin_url('{$in}') should equal '{$siteurl}{$out}'"); … … 66 63 67 64 function test_admin_url_invalid() { 68 $this->knownWPBug(7001);69 70 $siteurl = get_option('siteurl');71 72 65 $paths = array( 73 74 75 76 77 78 66 null => "/wp-admin/", 67 0 => "/wp-admin/", 68 -1 => "/wp-admin/", 69 '../foo/' => "/wp-admin/", 70 ' ' => "/wp-admin/", 71 ); 79 72 $https = array('on', 'off'); 80 73 81 74 foreach ($https as $val) { 82 75 $_SERVER['HTTPS'] = $val; … … 84 77 if ( $val == 'on' ) 85 78 $siteurl = str_replace('http://', 'https://', $siteurl); 86 79 87 80 foreach ($paths as $in => $out) { 88 81 $this->assertEquals( $siteurl.$out, admin_url($in), "admin_url('{$in}') should equal '{$siteurl}{$out}'");
Note: See TracChangeset
for help on using the changeset viewer.