1 node_example.test public NodeExampleTestCase::testNodeCreation()

Verify the functionality of the example module.


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


Functionality tests for node example module.


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

  // 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->assertText($edit['title'], "Found random title string");
  $this->assertPattern("/red.*green.*blue/", "Correct 'colors available' on node example page");