You are here

protected function MongoDBLogTestCase::checkCollection in MongoDB 7

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

Ensure collection is available and inform on behalf of caller if if is not.

Return value

bool Was the collection available ?

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 162
Contains \MongoDBLogTestCase.

Class

MongoDBLogTestCase

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;
}