You are here

public function RelationAddTestCase::testRelationAddUI in Relation add 7

UI tests relation add field.

@codingStandardsIgnoreStart

File

tests/relation_add.test, line 147
Tests for Relation Add module.

Class

RelationAddTestCase
Tests Relation Add.

Code

public function testRelationAddUI() {

  // @codingStandardsIgnoreEnd
  $langcode = LANGUAGE_NONE;
  $title_key = "title";
  $body_key = "body[{$langcode}][0][value]";
  $relation_key = "reladd[{$langcode}][0][relation_options][targets][target_2]";

  // Create node to edit.
  $edit = array();
  $edit[$title_key] = $this
    ->randomName(8);
  $edit[$body_key] = $this
    ->randomName(16);
  $edit[$relation_key] = $this->node1->title . ' [node:' . $this->node1->nid . ']';
  $this
    ->drupalPost('node/add/article', $edit, t('Save'));
  $this
    ->assertText($this->node1->title, 'Relation on the node page.');
  $this
    ->clickLink(t('Edit'));
  $edit = array();
  $edit[$relation_key] = $this->node4->title . ' [node:' . $this->node4->nid . ']';
  $this
    ->drupalPost(NULL, $edit, t('Save'));
  $this
    ->assertText($this->node4->title, 'Relation on the node page.');
  $this
    ->clickLink(t('Edit'));
  $edit = array();
  $edit['reladd[' . $langcode . '][0][delete]'] = 1;
  $this
    ->drupalPost(NULL, $edit, t('Save'));
  $this
    ->assertNoText($this->node4->title, 'Relation on the node page.');
}