You are here

public function SimpleTestExampleTestCase::testSimpleTestExampleCreate in Examples for Developers 7

Same name and namespace in other branches
  1. 6 simpletest_example/simpletest_example.test \SimpleTestExampleTestCase::testSimpleTestExampleCreate()

Create a simpletest_example node using the node form.

File

simpletest_example/simpletest_example.test, line 69
An example of simpletest tests to accompany the tutorial at http://drupal.org/node/890654.

Class

SimpleTestExampleTestCase
The SimpleTestExampleTestCase is a functional test case, meaning that it actually exercises a particular sequence of actions through the web UI. The majority of core test cases are done this way, but the SimpleTest suite also provides unit tests as…

Code

public function testSimpleTestExampleCreate() {

  // Create node to edit.
  $edit = array();
  $edit['title'] = $this
    ->randomName(8);
  $edit["body[und][0][value]"] = $this
    ->randomName(16);
  $this
    ->drupalPost('node/add/simpletest-example', $edit, t('Save'));
  $this
    ->assertText(t('SimpleTest Example Node Type @title has been created.', array(
    '@title' => $edit['title'],
  )));
}