You are here

public function StateFlowWebTestCase::testStateFlowStatesTableNullRecords in State Machine 7.3

Test that adding a node in the UI doesn't create NULL records.

Test that when an node is added in the UI, there are no NULL records in the state_flow_states table.

File

modules/state_flow/tests/state_flow.test, line 162
state_flow.test

Class

StateFlowWebTestCase
Unit tests for the StateFlow revision state machine.

Code

public function testStateFlowStatesTableNullRecords() {
  $edit = array();
  $new_title = $this
    ->randomName(8);
  $edit['title'] = $new_title;
  $edit['event'] = 'keep in draft';
  $edit['event_comment'] = $this
    ->randomName(8);
  $this
    ->drupalPost("node/add/article", $edit, t('Save'));

  // Get the highest vid for this node.
  $state_flow_states = db_select('state_flow_states', 'sfs')
    ->fields('sfs')
    ->execute()
    ->fetchAll();
  $this
    ->assertEqual(count($state_flow_states), 1, t('There is only one record in state_flow_states after adding a node through the ui.'));
  foreach ($state_flow_states as $state_record) {
    $this
      ->assertNotEqual($state_record->entity_id, NULL, t('The entity_id column for a state_flow_states record is not NULL.'));
    $this
      ->assertNotEqual($state_record->revision_id, NULL, t('The entity_id column for a state_flow_states record is not NULL.'));
  }
}