You are here

public function AuthcacheVarnishTestDefaultValidation::testValidateCustomXVarnishHeader in Authenticated User Page Caching (Authcache) 7.2

Test validation when custom reverse proxy header was selected.

File

modules/authcache_varnish/authcache_varnish.test, line 388
Test cases for authcache_varnish module.

Class

AuthcacheVarnishTestDefaultValidation
Unit tests for authcache_varnish_request_validate().

Code

public function testValidateCustomXVarnishHeader() {
  $this
    ->variableSet('authcache_varnish_validate_reverse_proxy_address', FALSE);
  $this
    ->variableSet('authcache_varnish_header', 'HTTP_X_CUSTOM_HEADER');
  $this
    ->assertIdentical(FALSE, authcache_varnish_request_validate(), 'Reject request when X-Custom-Header header is missing');
  $_SERVER['HTTP_X_CUSTOM_HEADER'] = '123';
  $this
    ->assertIdentical(TRUE, authcache_varnish_request_validate(), 'Accept request when X-Custom-Header header is present');
}