You are here

function LocationCCKTest::testNodeRevisionCleanup in Location 6.3

Same name and namespace in other branches
  1. 7.5 tests/location_cck.test \LocationCCKTest::testNodeRevisionCleanup()
  2. 7.3 tests/location_cck.test \LocationCCKTest::testNodeRevisionCleanup()
  3. 7.4 tests/location_cck.test \LocationCCKTest::testNodeRevisionCleanup()

File

tests/location_cck.test, line 352

Class

LocationCCKTest

Code

function testNodeRevisionCleanup() {
  $settings = array();
  $location_type = $this
    ->addLocationContentType($settings);
  $location1_name = $this
    ->randomName();
  $node = $this
    ->drupalCreateNode(array(
    'type' => $location_type,
    'field_loctest' => array(
      array(
        // First
        'name' => $location1_name,
      ),
    ),
  ));

  // Reload the node.
  $node = node_load($node->nid, NULL, TRUE);
  $changes = array(
    'revision' => TRUE,
    'log' => $this
      ->randomName(20),
  );
  $this
    ->flattenPostData($changes);
  $this
    ->drupalPost('node/' . $node->nid . '/edit', $changes, 'Save');

  // Reload the node again.
  $node1 = node_load($node->nid, $node->vid, TRUE);
  $node2 = node_load($node->nid, NULL, TRUE);
  $this
    ->deleteNode($node->nid);
  $result = db_query('SELECT * FROM {location} WHERE lid = %d', $node1->field_loctest[0]['lid']);
  if ($row = db_fetch_object($result)) {
    $this
      ->fail(t('Ensuring all revisions are cleaned up when a multiple revision node is deleted'));
  }
  else {
    $this
      ->pass(t('Ensuring all revisions are cleaned up when a multiple revision node is deleted'));
  }
}