You are here

function PublicationDateTestCase::testActionSavingSetDate in Publication Date 7

Same name and namespace in other branches
  1. 7.2 tests/publication_date.test \PublicationDateTestCase::testActionSavingSetDate()

File

tests/publication_date.test, line 146
Publication Date module tests.

Class

PublicationDateTestCase
@file Publication Date module tests.

Code

function testActionSavingSetDate() {
  $node = $this
    ->drupalCreateNode(array(
    'status' => 0,
  ));
  $unpublished_node = node_load($node->nid);
  $this
    ->assertTrue(empty($unpublished_node->published_at), 'Published date is initially empty');

  // Now publish this with our custom time...
  $unpublished_node->status = 1;
  $static_time = 12345678;
  $unpublished_node->published_at = $static_time;
  node_save($unpublished_node);
  $published_node = node_load($node->nid);

  // ...and see if it comes back with it correctly.
  $this
    ->assertTrue(is_numeric($published_node->published_at), 'Published date is integer/numberic once published');
  $this
    ->assertTrue($published_node->published_at == $static_time, 'Published date is set to what we expected');
}