1 node_example.test public NodeExampleTestCase::testNodeCreation()

Verify the functionality of the example module.

File

modules/examples/node_example/node_example.test, line 64
Simpletest case for node_example module.

Class

NodeExampleTestCase
Functionality tests for node example module.

Code

public function testNodeCreation() {
  // Create and login user.
  $account = $this->backdropCreateUser(array('access content', 'create node_example content'));
  $this->backdropLogin($account);

  // Create a new node. The image makes it more complicated, so skip it.
  $edit = array(
    'title' => $this->randomName(),
    'node_example_color[und][0][value]' => 'red',
    'node_example_color[und][1][value]' => 'green',
    'node_example_color[und][2][value]' => 'blue',
    'node_example_quantity[und][0][value]' => 100,
  );
  $this->backdropPost('node/add/node-example', $edit, t('Save'));
  $this->assertText("Example Node Type " . $edit['title'] . " has been created", "Found node creation message");
  $this->assertPattern("/The colors available.*red.*green.*blue/", "Correct 'colors available' on node page");

  // Look on the examples page to make sure it shows up there also.
  $this->backdropGet('examples/node_example');
  $this->assertText($edit['title'], "Found random title string");
  $this->assertPattern("/red.*green.*blue/", "Correct 'colors available' on node example page");

}