You are here

function WorkbenchModerationWebTestCase::_testOfDuplicateStates in Workbench Moderation 7.2

Helper function to check for duplicate state records.

1 call to WorkbenchModerationWebTestCase::_testOfDuplicateStates()
WorkbenchModerationDraftTabTestCase::testViewDraftTab in tests/workbench_moderation.test
Test View Draft tab.

File

tests/workbench_moderation.test, line 89
workbench_moderation.test

Class

WorkbenchModerationWebTestCase
Tests for Workbench Moderation.

Code

function _testOfDuplicateStates() {
  $states = db_select('state_flow_states')
    ->fields('state_flow_states', array())
    ->execute()
    ->fetchAll();
  $hids = array();
  $duplicates = FALSE;
  foreach ($states as $state) {
    if (!empty($state->hid)) {
      if (empty($hids[$state->hid])) {
        $hids[$state->hid][] = $state;
      }
      else {
        $duplicates = TRUE;
      }
    }
  }
  $this
    ->assertFalse($duplicates, t('There are no duplicate records in State Flow States'));
  if ($duplicates) {
    debug($states);
  }
}