You are here

public function BlockCacheTest::setUp in MongoDB 7

Setup the test.

File

mongodb_block_ui/src/Tests/BlockCacheTest.php, line 45

Class

BlockCacheTest
Test block caching.

Namespace

Drupal\mongodb_block_ui\Tests

Code

public function setUp() {
  parent::setUp('block_test');

  // Create an admin user, log in and enable test blocks.
  $this->adminUser = $this
    ->drupalCreateUser(array(
    'administer blocks',
    'access administration pages',
  ));
  $this
    ->drupalLogin($this->adminUser);

  // Create additional users to test caching modes.
  $this->normalUser = $this
    ->drupalCreateUser();
  $this->normalUserAlt = $this
    ->drupalCreateUser();

  // Sync the roles, since drupalCreateUser() creates separate roles for
  // the same permission sets.
  user_save($this->normalUserAlt, array(
    'roles' => $this->normalUser->roles,
  ));
  $this->normalUserAlt->roles = $this->normalUser->roles;

  // Enable block caching.
  variable_set('block_cache', TRUE);

  // Enable our test block.
  $edit['block_test_test_cache[region]'] = 'sidebar_first';
  $this
    ->drupalPost('admin/structure/block', $edit, t('Save blocks'));
}