diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeLastChangedTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeLastChangedTest.php new file mode 100644 index 0000000..96e6f1a --- /dev/null +++ b/core/modules/node/lib/Drupal/node/Tests/NodeLastChangedTest.php @@ -0,0 +1,53 @@ + 'Node Last Changed', + 'description' => 'Tests the node_last_changed() function.', + 'group' => 'Node', + ); + } + + public function setUp() { + parent::setUp(); + $this->installSchema('node', 'node'); + $this->installSchema('node', 'node_field_data'); + $this->installSchema('node', 'node_field_revision'); + } + + /** + * Runs basic tests for node_last_changed function. + */ + function testNodeLastChanged() { + $node = entity_create('node', array('type' => 'article', 'title' => $this->randomName())); + $node->save(); + + // Test node last changed timestamp. + $changed_timestamp = node_last_changed($node->id()); + $this->assertEqual($changed_timestamp, $node->getChangedTime(), 'Expected last changed timestamp returned.'); + + $changed_timestamp = node_last_changed($node->id(), $node->language()->id); + $this->assertEqual($changed_timestamp, $node->getChangedTime(), 'Expected last changed timestamp returned.'); + } +}