You are here

public function NodeExampleTestCase::testBodyLabel in Examples for Developers 7

Check the value of body label.

Checks whether body label has a value of "Example Description"

File

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

Class

NodeExampleTestCase
Functionality tests for node example module.

Code

public function testBodyLabel() {

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

  // Request a node add node-example page.
  // Test whether the body label equals 'Example Description'.
  // Use '$this->assertRaw' to make certain to test the body label and not
  // some other text.
  $this
    ->drupalGet('node/add/node-example');
  $this
    ->assertResponse(200, 'node/add/node-example page found');
  $this
    ->assertRaw('<label for="edit-body-und-0-value">Example Description </label>', 'Body label equals \'Example Description\'');
}