You are here

public function AuthcacheP13nTestFrontcontroller::testInvalidHTTPMethod in Authenticated User Page Caching (Authcache) 7.2

Ensure that fc responds with 405 Method Not Allowed to POST requests.

File

modules/authcache_p13n/tests/authcache_p13n.frontcontroller.test, line 94
Defines tests for authcache frontcontroller for personalized requests.

Class

AuthcacheP13nTestFrontcontroller
Tests for authcache frontcontroller for personalized requests.

Code

public function testInvalidHTTPMethod() {
  $headers = array(
    'X-Authcache: 1',
  );
  $params = array(
    'r' => 'test/good',
    'q' => 'node',
  );

  // We need to post manually here, drupalPost would attempt to GET the form
  // before (and would fail).
  $action = url($this->fcURL, array(
    'query' => $params,
    'absolute' => TRUE,
  ));
  $result = $this
    ->curlExec(array(
    CURLOPT_URL => $action,
    CURLOPT_POST => TRUE,
    CURLOPT_POSTFIELDS => '',
    CURLOPT_HTTPHEADER => $headers,
  ));

  // Ensure that any changes to variables in the other thread are picked up.
  $this
    ->refreshVariables();
  $this
    ->assertResponse(405);
  $this
    ->assertEqual('', $result);
}