You are here

public function RestfulCsrfTokenTestCase::testCsrfTokenAnon in RESTful 7.2

Same name and namespace in other branches
  1. 7 tests/RestfulCsrfTokenTestCase.test \RestfulCsrfTokenTestCase::testCsrfTokenAnon()

Test the validation of a CSRF token for anonymous users.

File

tests/RestfulCsrfTokenTestCase.test, line 74
Contains RestfulCsrfTokenTestCase

Class

RestfulCsrfTokenTestCase

Code

public function testCsrfTokenAnon() {
  global $user;
  $user = drupal_anonymous_user();

  // Allow anonymous user to CRUD article content.
  $permissions = array(
    'create article content' => TRUE,
    'edit any article content' => TRUE,
    'delete any article content' => TRUE,
  );
  user_role_change_permissions(DRUPAL_ANONYMOUS_RID, $permissions);
  $this
    ->checkCsrfRequest($this->writeOperations, FALSE, FALSE);
}