function NodeConvertTestCase::testSimpleNodeConvertUI in Node Convert 7
Same name and namespace in other branches
- 6 node_convert.test \NodeConvertTestCase::testSimpleNodeConvertUI()
Tests converting via UI.
File
- ./
node_convert.test, line 74 - Node convert Simpletest Unit
Class
- NodeConvertTestCase
- Class NodeConvertTestCase
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_query("SELECT type FROM {node} WHERE nid = :nid", array(
':nid' => $node->nid,
))
->fetchField();
$this
->assertEqual($result, $type2_name, t("The converted node type is equal to the destination node type."));
}