You are here

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

Request has correct X-Authcache-Varnish-Passphrase.

File

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

Class

AuthcacheVarnishTestDefaultValidation
Unit tests for authcache_varnish_request_validate().

Code

public function testValidatePassphraseHeader() {
  $this
    ->variableSet('authcache_varnish_passphrase', 'sEcr3t!');
  $_SERVER['REMOTE_ADDR'] = $this->proxyIp;
  $_SERVER['HTTP_X_AUTHCACHE_VARNISH_PASSPHRASE'] = 'sEcr3t!';
  $this
    ->assertIdentical(TRUE, authcache_varnish_request_validate(), 'Accept request when proxy passphrase matches');
  $_SERVER['REMOTE_ADDR'] = $this->untrustedIp;
  $_SERVER['HTTP_X_AUTHCACHE_VARNISH_PASSPHRASE'] = 'sEcr3t!';
  $this
    ->assertIdentical(TRUE, authcache_varnish_request_validate(), 'Accept request when proxy passphrase matches, even from untrusted ip');
}