You are here

protected function MongoDBLogTestCase::checkCollection in MongoDB 8

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

Ensure collection availability and inform on behalf of caller if if does not.

Return value

boolean

1 call to MongoDBLogTestCase::checkCollection()
MongoDBLogTestCase::testWatchdogLimit in mongodb_watchdog/mongodb_watchdog.test
Test the default and non-default mongodb_watchdog insertion behaviours.

File

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

Class

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

Code

protected function checkCollection() {
  if (!empty($this->collection)) {
    return TRUE;
  }
  $stack = debug_backtrace();
  $method = $stack[1]['function'];
  if (strtolower(substr($method, 0, 4)) == 'test') {
    $this
      ->pass(t('%test test skipped: no collection.', array(
      '%test' => substr($method, 4),
    )), $this->group);
  }
  return FALSE;
}