You are here

function VarnishTestCase::setUpPermissions in Varnish 6

Set up permissions for the anonymous user so that it's possible to access all content that can be invalidated.

1 call to VarnishTestCase::setUpPermissions()
VarnishTestCase::setUp in ./varnish.test
Generates a random database prefix, runs the install scripts on the prefixed database and enable the specified modules. After installation many caches are flushed and the internal browser is setup so that the page requests will run on the new prefix.…

File

./varnish.test, line 51
Tests the basic functionality of Varnish.

Class

VarnishTestCase
Base class for Varnish Test Cases.

Code

function setUpPermissions() {

  // Get the default permissions.
  $permissions = explode(', ', db_result(db_query("SELECT perm FROM {permission} WHERE rid = %d", 1)));

  // Assign access comments and access user profiles permission to anonymous users.
  $permissions[] = 'access comments';
  $permissions[] = 'access user profiles';
  db_query("DELETE FROM {permission} WHERE rid = %d", 1);
  db_query("INSERT INTO {permission} (rid, perm) VALUES (%d, '%s')", 1, implode(', ', $permissions));
}