You are here

function UUIDFunctionalityTestCase::testDefaultNodeUUID in Universally Unique IDentifier 6

Verify uuid behavior for nodes.

File

./uuid.test, line 144
Functionality tests for UUID module.

Class

UUIDFunctionalityTestCase
Test basic uuid resolver functionality.

Code

function testDefaultNodeUUID() {

  // Create a user.
  $account = $this
    ->drupalCreateUser(array(
    'create page content',
  ));

  // Create a node with that user.
  $options = array(
    'uid' => $account->uid,
    'type' => 'page',
  );
  $object = $this
    ->drupalCreateNode($options);

  // Verify fields are not attached to the node.
  $this
    ->assertTrue(empty($object->uuid), t("Node has no uuid field attached with default settings."), t("Node UUID"));
  $this
    ->assertTrue(empty($object->revision_uuid), t("Node has no revision_uuid field attached with default settings."), t("Node revision UUID"));

  // Create a new revision for this node.
  $object->revision = 1;
  node_save($object);

  // Verify fields are not attached to the node.
  $this
    ->assertTrue(empty($object->uuid), t("Node has no uuid field attached with default settings."), t("Node UUID"));
  $this
    ->assertTrue(empty($object->revision_uuid), t("Node has no revision_uuid field attached with default settings."), t("Node revision UUID"));

  // Show current node only in verbose mode.
  $this
    ->verbose(print_r($object, 1));
}