|
@@ 40-61 (lines=22) @@
|
| 37 |
|
} |
| 38 |
|
} |
| 39 |
|
|
| 40 |
|
public function test_url_query_payload_with_wp_referer() |
| 41 |
|
{ |
| 42 |
|
if ( version_compare( get_bloginfo('version'), '4.5', '<' ) ) { |
| 43 |
|
$this->markTestSkipped( 'wp_get_raw_referer function was introduced in WP 4.5' ); |
| 44 |
|
return; |
| 45 |
|
} |
| 46 |
|
|
| 47 |
|
$base_url = 'http://example.org'; |
| 48 |
|
$_REQUEST['_wp_http_referer'] = 'http://toto.org'; |
| 49 |
|
$this->go_to( $base_url ); |
| 50 |
|
|
| 51 |
|
$payload = wpmautic_get_url_query(); |
| 52 |
|
|
| 53 |
|
$title = sprintf( "%s – %s", WP_TESTS_TITLE, get_option( 'blogdescription' ) ); |
| 54 |
|
|
| 55 |
|
$this->assertEquals($payload['page_url'], $base_url); |
| 56 |
|
$this->assertEquals($payload['page_title'], $title); |
| 57 |
|
$this->assertEquals($payload['language'], get_locale()); |
| 58 |
|
$this->assertEquals($payload['referrer'], 'http://toto.org'); |
| 59 |
|
|
| 60 |
|
unset($_REQUEST['_wp_http_referer']); |
| 61 |
|
} |
| 62 |
|
|
| 63 |
|
public function test_url_query_payload_with_server_referer() |
| 64 |
|
{ |
|
@@ 63-84 (lines=22) @@
|
| 60 |
|
unset($_REQUEST['_wp_http_referer']); |
| 61 |
|
} |
| 62 |
|
|
| 63 |
|
public function test_url_query_payload_with_server_referer() |
| 64 |
|
{ |
| 65 |
|
if ( version_compare( get_bloginfo('version'), '4.5', '<' ) ) { |
| 66 |
|
$this->markTestSkipped( 'wp_get_raw_referer function was introduced in WP 4.5' ); |
| 67 |
|
return; |
| 68 |
|
} |
| 69 |
|
|
| 70 |
|
$base_url = 'http://example.org'; |
| 71 |
|
$_SERVER['HTTP_REFERER'] = 'http://toto.org'; |
| 72 |
|
$this->go_to( $base_url ); |
| 73 |
|
|
| 74 |
|
$payload = wpmautic_get_url_query(); |
| 75 |
|
|
| 76 |
|
$title = sprintf( "%s – %s", WP_TESTS_TITLE, get_option( 'blogdescription' ) ); |
| 77 |
|
|
| 78 |
|
$this->assertEquals($payload['page_url'], $base_url); |
| 79 |
|
$this->assertEquals($payload['page_title'], $title); |
| 80 |
|
$this->assertEquals($payload['language'], get_locale()); |
| 81 |
|
$this->assertEquals($payload['referrer'], 'http://toto.org'); |
| 82 |
|
|
| 83 |
|
unset($_SERVER['HTTP_REFERER']); |
| 84 |
|
} |
| 85 |
|
} |
| 86 |
|
|