You are here

public function MongoDBLogTestCase::setUp in MongoDB 7

Same name and namespace in other branches
  1. 8 mongodb_watchdog/mongodb_watchdog.test \MongoDBLogTestCase::setUp()
  2. 6 mongodb_watchdog/mongodb_watchdog.test \MongoDBLogTestCase::setUp()

Enable modules and create users with specific permissions.

Overrides DrupalWebTestCase::setUp

File

mongodb_watchdog/mongodb_watchdog.test, line 74
Contains \MongoDBLogTestCase.

Class

MongoDBLogTestCase

Code

public function setUp() {

  // Support using the MongoDB cache.
  drupal_flush_all_caches();
  $this->group = t('Setup');
  parent::setUp('mongodb', 'mongodb_watchdog', 'blog', 'poll');

  // Create users.
  $this->bigUser = $this
    ->drupalCreateUser(array(
    'administer site configuration',
    'access administration pages',
    'access site reports',
    'administer users',
  ));
  $this->anyUser = $this
    ->drupalCreateUser(array(
    'access content',
  ));
  $this->requestTime = REQUEST_TIME;
  try {
    $this->collection = mongodb_collection(variable_get('mongodb_watchdog', 'watchdog'));
  } catch (Exception $e) {
    $this->collection = NULL;
  }
  $this
    ->assertNotNull($this->collection, t('Access MongoDB watchdog collection'), $this->group);
}