You are here

function NodeConvertTestCase::testSimpleNodeConvertUI in Node Convert 6

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

File

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

Class

NodeConvertTestCase
@file Node convert Simpletest Unit

Code

function testSimpleNodeConvertUI() {
  $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,
  ));
  $admin_user = $this
    ->drupalCreateUser(array(
    'administer site configuration',
    'access administration pages',
    'administer nodes',
    'administer content types',
    'administer conversion',
    'convert from ' . $type1_name,
    'convert to ' . $type2_name,
  ));
  $this
    ->drupalLogin($admin_user);
  $edit['type'] = $type1_name;
  $node = $this
    ->drupalCreateNode($edit);
  $edit = array();
  $edit['destination_type'] = $type2_name;
  $this
    ->drupalPost('node/' . $node->nid . '/convert', $edit, t("Next"));
  $this
    ->drupalPost(NULL, array(), t("Convert"));
  $this
    ->assertText(t("Node @nid has been converted successfully.", array(
    '@nid' => $node->nid,
  )), t("Simple node conversion ui test passed."));
  $result = db_result(db_query("SELECT type FROM {node} WHERE nid = %d", $node->nid));
  $this
    ->assertEqual($result, $type2_name, t("The converted node type is equal to the destination node type."));
}