1 node_type_example.test public NodeTypeExampleTest::testNodeCreation()

Verifies the functionality of the Node Type Example module.

File

modules/examples/node_type_example/tests/node_type_example.test, line 61
Simpletest case for the Node Type Example module.

Class

NodeTypeExampleTest
Functionality tests for The Node Type Example module.

Code

public function testNodeCreation() {
  $account = $this->backdropCreateUser(array('access content', 'create node_type_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-type-example', $edit, t('Save'));
  $this->assertText("Example content 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_type_example');
  $this->assertText($edit['title'], "Found random title string");
  $this->assertPattern("/red.*green.*blue/", "Correct 'colors available' on the page");
}