NodeCreationTestCase::testNodeCreation

7 node.test NodeCreationTestCase::testNodeCreation()
8 node.test NodeCreationTestCase::testNodeCreation()

Create a "Basic page" node and verify its consistency in the database.

File

modules/node/node.test, line 488
Tests for node.module.

Code

function testNodeCreation() {
  // Create a node.
  $edit = array();
  $langcode = LANGUAGE_NONE;
  $edit["title"] = $this->randomName(8);
  $edit["body[$langcode][0][value]"] = $this->randomName(16);
  $this->drupalPost('node/add/page', $edit, t('Save'));

  // Check that the Basic page has been created.
  $this->assertRaw(t('!post %title has been created.', array('!post' => 'Basic page', '%title' => $edit["title"])), t('Basic page created.'));

  // Check that the node exists in the database.
  $node = $this->drupalGetNodeByTitle($edit["title"]);
  $this->assertTrue($node, t('Node found in database.'));
}
Login or register to post comments