You are here

function MongoDBLogTestCase::setUp in MongoDB 8

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

Enable modules and create users with specific permissions.

File

mongodb_watchdog/mongodb_watchdog.test, line 73
Test class for MongoDB_watchdog.

Class

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

Code

function setUp() {
  $this->group = t('Setup');
  parent::setUp('mongodb', 'mongodb_watchdog', 'blog', 'poll');

  // Create users.
  $this->big_user = $this
    ->drupalCreateUser(array(
    'administer site configuration',
    'access administration pages',
    'access site reports',
    'administer users',
  ));
  $this->any_user = $this
    ->drupalCreateUser(array(
    'access content',
  ));
  $this->request_time = 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);
}