You are here

function NodeExampleTestCase::testNodeCreation in Examples for Developers 6

Same name and namespace in other branches
  1. 7 node_example/node_example.test \NodeExampleTestCase::testNodeCreation()

Verify the functionality of the example module.

File

node_example/node_example.test, line 31
Simpletest case for node_example module.

Class

NodeExampleTestCase
Functionality tests for node example module.

Code

function testNodeCreation() {

  // Create and login user.
  $account = $this
    ->drupalCreateUser(array(
    'access content',
    'create example content',
  ));
  $this
    ->drupalLogin($account);

  // Create a new node. The image makes it more complicated, so skip it.
  $edit = array(
    'title' => $this
      ->randomName(),
    'color' => 'red',
    'quantity' => 100,
  );
  $this
    ->drupalPost('node/add/example-node-type-1', $edit, t('Save'));
  $this
    ->assertText(t("Example node type 1 @title has been created", array(
    '@title' => $edit['title'],
  )));
  $this
    ->assertText(t('The order is for @number @color items', array(
    '@number' => $edit['quantity'],
    '@color' => $edit['color'],
  )));
}