You are here

function TokenExampleTestCase::testInterface in Examples for Developers 6

Same name and namespace in other branches
  1. 7 token_example/token_example.test \TokenExampleTestCase::testInterface()

File

token_example/token_example.test, line 26
Test cases for Testing the token example module.

Class

TokenExampleTestCase
@file Test cases for Testing the token example module.

Code

function testInterface() {
  $this
    ->drupalGet('examples/token');
  $this
    ->assertNoFieldByName('node');
  $this
    ->assertNoFieldByName('user');
  $edit = array(
    'text' => 'User [user-name] is trying the token example!',
  );
  $this
    ->drupalPost(NULL, $edit, t('Submit'));
  $this
    ->assertText('User ' . $this->web_user->name . ' is trying the token example!');
  $node = $this
    ->drupalCreateNode(array(
    'title' => 'Example node',
    'status' => 1,
  ));
  $this
    ->drupalGet('examples/token');
  $edit = array(
    'text' => 'Would you like to view the [type-name] [title]?',
    'node' => $node->nid,
  );
  $this
    ->drupalPost(NULL, $edit, t('Submit'));
  $this
    ->assertText('Would you like to view the Page Example node?');
}