You are here

public function LinkTokenTest::xTestLinkWithTitleAttributeTokenTitleForm in Link 7

Link With Title Attribute token title form.

If the title of the link is set to the title attribute, then the title attribute isn't supposed to show.

@codingStandardsIgnoreStart

File

tests/LinkTokenTest.test, line 234
Testing that tokens can be used in link titles.

Class

LinkTokenTest
Testing that tokens can be used in link titles.

Code

public function xTestLinkWithTitleAttributeTokenTitleForm() {

  // @codingStandardsIgnoreEnd
  $this
    ->loginWithPermissions($this->permissions);
  $this
    ->acquireContentTypes(1);
  $field_settings = array(
    'type' => 'link',
    'widget_type' => 'link',
    'type_name' => $this->content_types[0]->name,
    'attributes' => array(
      'class' => '',
      'target' => 'default',
      'rel' => 'nofollow',
      'title' => '',
    ),
  );
  $field = $this
    ->createField($field_settings, 0);
  $field_name = $field['field_name'];
  $url_type = str_replace('_', '-', $this->content_types[0]->type);
  $edit = array(
    'attributes[title]' => '[' . $field_name . '-title]',
    'enable_tokens' => TRUE,
  );
  $this
    ->drupalPost('admin/content/node-type/' . $url_type . '/fields/' . $field['field_name'], $edit, t('Save field settings'));
  $this
    ->assertText(t('Saved field @field_name', array(
    '@field_name' => $field['field_name'],
  )));

  // So, having saved this field_name, let's see if it works...
  $this
    ->acquireNodes(1);
  $this
    ->drupalGet('node/' . $this->nodes[0]->nid);
  $edit = array();
  $edit[$field['field_name'] . '[0][url]'] = 'http://www.example.com/test';
  $title = 'title_' . $this
    ->randomName(20);
  $edit[$field['field_name'] . '[0][title]'] = $title;
  $this
    ->drupalPost('node/' . $this->nodes[0]->nid . '/edit', $edit, t('Save'));

  // Make sure we get a new version!
  $node = node_load($this->nodes[0]->nid, NULL, TRUE);
  $this
    ->assertText(t('@type @title has been updated.', array(
    '@title' => $node->title,
    '@type' => $this->content_types[0]->name,
  )));
  $this
    ->drupalGet('node/' . $node->nid);
  $this
    ->assertText($title, 'Make sure the link title/text shows');
  $this
    ->assertNoRaw(' title="' . $title . '"', "We should not show the link title as the title attribute?");
  $this
    ->assertNoRaw(' title="[' . $field_name . '-title]"');

  // $this->fail($this->content);.
}