You are here

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

Request has the wrong X-Authcache-Varnish-Passphrase.

File

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

Class

AuthcacheVarnishTestDefaultValidation
Unit tests for authcache_varnish_request_validate().

Code

public function testRejectPassphraseIfNotIdentical() {
  $this
    ->variableSet('authcache_varnish_passphrase', 'sEcr3t!');
  $_SERVER['REMOTE_ADDR'] = $this->proxyIp;
  $_SERVER['HTTP_X_AUTHCACHE_VARNISH_PASSPHRASE'] = 'lEak3d!';
  $this
    ->assertIdentical(FALSE, authcache_varnish_request_validate(), 'Reject request when proxy passphrase does not match, even from trusted ip');
  $_SERVER['REMOTE_ADDR'] = $this->untrustedIp;
  $_SERVER['HTTP_X_AUTHCACHE_VARNISH_PASSPHRASE'] = 'lEak3d!';
  $this
    ->assertIdentical(FALSE, authcache_varnish_request_validate(), 'Reject request when proxy passphrase does not match');
}