Changeset 38036 for trunk/tests/phpunit/tests/general/resourceHints.php
- Timestamp:
- 07/12/2016 11:31:58 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/general/resourceHints.php
r37951 r38036 32 32 33 33 function test_should_have_defaults_on_frontend() { 34 $expected = "<link rel='preconnect' href='http://s.w.org'>\ r\n";34 $expected = "<link rel='preconnect' href='http://s.w.org'>\n"; 35 35 36 36 $this->expectOutputString( $expected ); … … 40 40 41 41 function test_dns_prefetching() { 42 $expected = "<link rel='dns-prefetch' href=' http://wordpress.org'>\r\n" .43 "<link rel='dns-prefetch' href=' https://google.com'>\r\n" .44 "<link rel='dns-prefetch' href=' make.wordpress.org'>\r\n" .45 "<link rel='preconnect' href='http://s.w.org'>\ r\n";42 $expected = "<link rel='dns-prefetch' href='//wordpress.org'>\n" . 43 "<link rel='dns-prefetch' href='//google.com'>\n" . 44 "<link rel='dns-prefetch' href='//make.wordpress.org'>\n" . 45 "<link rel='preconnect' href='http://s.w.org'>\n"; 46 46 47 47 add_filter( 'wp_resource_hints', array( $this, '_add_dns_prefetch_domains' ), 10, 2 ); … … 57 57 if ( 'dns-prefetch' === $method ) { 58 58 $hints[] = 'http://wordpress.org'; 59 $hints[] = 'https://wordpress.org'; 60 $hints[] = 'htps://wordpress.org'; // Invalid URLs should be skipped. 59 61 $hints[] = 'https://google.com'; 60 62 $hints[] = '//make.wordpress.org'; 63 $hints[] = 'https://wordpress.org/plugins/'; 61 64 } 62 65 … … 65 68 66 69 function test_prerender() { 67 $expected = "<link rel='preconnect' href='http://s.w.org'>\ r\n" .68 "<link rel='prerender' href='https://make.wordpress.org/great-again'>\ r\n" .69 "<link rel='prerender' href='http://jobs.wordpress.net'>\ r\n" .70 "<link rel='prerender' href='//core.trac.wordpress.org'>\ r\n";70 $expected = "<link rel='preconnect' href='http://s.w.org'>\n" . 71 "<link rel='prerender' href='https://make.wordpress.org/great-again'>\n" . 72 "<link rel='prerender' href='http://jobs.wordpress.net'>\n" . 73 "<link rel='prerender' href='//core.trac.wordpress.org'>\n"; 71 74 72 75 add_filter( 'wp_resource_hints', array( $this, '_add_prerender_urls' ), 10, 2 ); … … 84 87 $hints[] = 'http://jobs.wordpress.net'; 85 88 $hints[] = '//core.trac.wordpress.org'; 89 $hints[] = 'htps://wordpress.org'; // Invalid URLs should be skipped. 86 90 } 87 91 … … 90 94 91 95 function test_parse_url_dns_prefetch() { 92 $expected = "<link rel='dns-prefetch' href=' http://make.wordpress.org'>\r\n" .93 "<link rel='preconnect' href='http://s.w.org'>\ r\n";96 $expected = "<link rel='dns-prefetch' href='//make.wordpress.org'>\n" . 97 "<link rel='preconnect' href='http://s.w.org'>\n"; 94 98 95 99 add_filter( 'wp_resource_hints', array( $this, '_add_dns_prefetch_long_urls' ), 10, 2 ); … … 111 115 112 116 function test_dns_prefetch_styles() { 113 $expected = "<link rel='dns-prefetch' href=' http://fonts.googleapis.com'>\r\n" .114 "<link rel='preconnect' href='http://s.w.org'>\ r\n";117 $expected = "<link rel='dns-prefetch' href='//fonts.googleapis.com'>\n" . 118 "<link rel='preconnect' href='http://s.w.org'>\n"; 115 119 116 120 $args = array( … … 130 134 131 135 function test_dns_prefetch_scripts() { 132 $expected = "<link rel='dns-prefetch' href=' http://fonts.googleapis.com'>\r\n" .133 "<link rel='preconnect' href='http://s.w.org'>\ r\n";136 $expected = "<link rel='dns-prefetch' href='//fonts.googleapis.com'>\n" . 137 "<link rel='preconnect' href='http://s.w.org'>\n"; 134 138 135 139 $args = array(
Note: See TracChangeset
for help on using the changeset viewer.