public function AuthcacheVarnishTestDefaultValidation::testValidateDefaultXVarnishHeader in Authenticated User Page Caching (Authcache) 7.2
Test validation of X-Varnish HTTP header.
File
- modules/
authcache_varnish/ authcache_varnish.test, line 377 - Test cases for authcache_varnish module.
Class
- AuthcacheVarnishTestDefaultValidation
- Unit tests for authcache_varnish_request_validate().
Code
public function testValidateDefaultXVarnishHeader() {
$this
->variableSet('authcache_varnish_validate_reverse_proxy_address', FALSE);
$this
->assertIdentical(FALSE, authcache_varnish_request_validate(), 'Reject request when X-Varnish header is missing');
$_SERVER['HTTP_X_VARNISH'] = '123';
$this
->assertIdentical(TRUE, authcache_varnish_request_validate(), 'Accept request when X-Varnish header is present');
}