You are here

public function MongoDBLogTestCase::setUp in MongoDB 6

Same name and namespace in other branches
  1. 8 mongodb_watchdog/mongodb_watchdog.test \MongoDBLogTestCase::setUp()
  2. 7 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 84
Test class for MongoDB_watchdog.

Class

MongoDBLogTestCase
Test the behaviour of watchdog() mongodb_watchdog, not dblog.

Code

public function setUp() {
  $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 = 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);
}