public function OverrideNodeOptionsTest::testNodeCreatedDateDoesNotChange in Override Node Options 7
Ensure that the node created date does not change when the node is edited.
File
- src/
Tests/ Functional/ OverrideNodeOptionsTest.php, line 229 - Unit tests for the override_node_options module.
Class
- OverrideNodeOptionsTest
- Defines a base class for testing the Override Node Options module.
Namespace
Drupal\override_node_options\Tests\FunctionalCode
public function testNodeCreatedDateDoesNotChange() {
$this
->drupalLogin($this
->drupalCreateUser(array(
'edit any page content',
)));
$node = $this
->drupalCreateNode();
// Update the node.
$this
->drupalPost("node/{$node->nid}/edit", array(), t('Save'));
// Load a new instance of the node.
$node2 = node_load($node->nid);
// Ensure that the node was updated by comparing the changed dates, but the
// created dates still match.
$this
->assertNotEqual($node->changed, $node2->changed, t('Changed values do not match.'));
$this
->assertEqual($node->created, $node2->created, t('Created values do match.'));
}