You are here

function NodeConvertTestCase::testSimpleNodeConvert in Node Convert 7

Same name and namespace in other branches
  1. 6 node_convert.test \NodeConvertTestCase::testSimpleNodeConvert()

Tests simple node conversion.

File

./node_convert.test, line 51
Node convert Simpletest Unit

Class

NodeConvertTestCase
Class NodeConvertTestCase

Code

function testSimpleNodeConvert() {
  $type1_name = $this
    ->randomName(4);
  $type2_name = $this
    ->randomName(4);
  $type1 = $this
    ->drupalCreateContentType(array(
    'type' => $type1_name,
    'name' => $type1_name,
  ));
  $type2 = $this
    ->drupalCreateContentType(array(
    'type' => $type2_name,
    'name' => $type2_name,
  ));
  $edit['type'] = $type1_name;
  $node = $this
    ->drupalCreateNode($edit);
  node_convert_node_convert($node->nid, $type2_name, array(), array(), TRUE);
  $result = db_query("SELECT type FROM {node} WHERE nid = :nid", array(
    ':nid' => $node->nid,
  ))
    ->fetchField();
  $this
    ->assertEqual($result, $type2_name, t("Simple node conversion passed."));
}