public function StateFlowWebTestCase::testOfStraightToPublished in State Machine 7.3
Verify that two node objects are not saved.
File
- modules/
state_flow/ tests/ state_flow.test, line 188 - state_flow.test
Class
- StateFlowWebTestCase
- Unit tests for the StateFlow revision state machine.
Code
public function testOfStraightToPublished() {
$edit = array();
$title = $this
->randomName(8);
$edit['title'] = $title;
$edit['event'] = 'publish';
$edit['event_comment'] = $event_comment = $this
->randomName(8);
$this
->drupalPost("node/add/article", $edit, t('Save'));
$this
->drupalGet("node/1");
// Get the highest vid for this node.
$node_records = db_select('node', 'n')
->fields('n')
->execute()
->fetchAll();
$this
->assertEqual(count($node_records), 1, t('There is one record in the node table'));
$state_flow_history = db_select('state_flow_history', 'sfh')
->fields('sfh')
->condition('entity_id', 1)
->condition('entity_type', 'node')
->execute()
->fetchAll();
$this
->assertEqual(count($state_flow_history), 1, t('There is one record in the node table'));
$this
->assertEqual($state_flow_history[0]->state, 'published', t('The state flow history record for node 1 has "published" in the state column.'));
$this
->assertEqual($state_flow_history[0]->log, $event_comment, t('The state flow history record for node 1 has the correct log message.'));
}