1 link.token.test LinkTokenTest::testTitleOnlyTitleNoLink()

Test that if you have a title and no URL on a field which does not have tokens enabled, that the title is sanitized once.

File

core/modules/link/tests/link.token.test, line 73
Contains simpletests making sure token integration works.

Class

LinkTokenTest
Testing that tokens can be used in link titles

Code

function testTitleOnlyTitleNoLink() {
  $settings = array(
    'instance[settings][url]' => 1,
    'instance[settings][enable_tokens]' => 0,
  );
  $field_name = $this->createLinkField('page', $settings);

  $this->backdropGet('node/add/page');
  $this->assertField($field_name . '[und][0][url]', 'URL found');

  $input = array(
    'title' => 'This & That',
    'href' => '',
  );

  $edit = array(
    'title' => 'Simple title',
    $field_name . '[und][0][title]' => $input['title'],
    $field_name . '[und][0][url]' => $input['href'],
  );
  $this->backdropPost(NULL, $edit, t('Save'));

  $this->assertRaw('This & That');
}