public function StateFlowSPSIntegrationWebTest::testStateFlowBasicTableData in State Machine 7.2
File
- modules/
state_flow_sps/ tests/ StateFlowSPSIntegrationWeb.test, line 15
Class
Code
public function testStateFlowBasicTableData() {
$this
->clearSchedule();
$basic = array(
array(
2,
2,
time() + 1000,
),
array(
2,
5,
time() + 2000,
),
array(
3,
8,
time() + 3000,
),
array(
3,
11,
time() + 4000,
),
array(
4,
12,
time() + 10000,
),
array(
4,
14,
time() + 20000,
),
array(
5,
17,
time() + 30000,
),
array(
5,
18,
time() + 40000,
),
);
$this
->addValuesToSchedule($basic);
$test_manager = new Drupal\sps\Test\Manager();
$state_flow_override = new Drupal\state_flow_sps\StateFlowOverride(array(), $test_manager);
$state_flow_override
->setData(time());
$overrides = $state_flow_override
->getOverrides();
$this
->assertTrue(empty($overrides), 'StateFlowOverrides should not return any overrides if none exist for the timeframe.');
$state_flow_override
->setData(time() + 2500);
$overrides = $state_flow_override
->getOverrides();
$this
->verbose('<pre>' . print_r($overrides, TRUE) . '</pre>');
$this
->assertTrue(!empty($overrides['node-2']), 'StateFlowOverride should return nodes in the \'Scheduled\' state.');
$this
->assertEqual($overrides['node-2']['vid'], 5, 'StateFlowOverride should properly find the revision a node will be transitioned to.');
if (!empty($overrides['node-3'])) {
$this
->fail('StateFlowOverrides should not return overrides scheduled in the future');
}
else {
$this
->pass('StateFlowOverrides should not return overrides scheduled in the future');
}
}