You are here

function RelationDummyFieldTestCase::testDummyFieldDisplayed in Relation 7

Create a relation field on the Article node type, and check if it displays the relations correctly on the node page.

File

relation_dummy_field/tests/relation_dummy_field.test, line 61
Tests for Relation Dummy Field module.

Class

RelationDummyFieldTestCase
Functional test of Relation's integration with the Dummy Field.

Code

function testDummyFieldDisplayed() {
  $this
    ->drupalGet('node/' . $this->node1->nid);
  $this
    ->assertNoRaw($this->node4->title, 'Node 4 title is not found');
  $this
    ->createDummyField();

  // Assert that user without access relations permission does not see the
  // endpoint label.
  $test_user = $this
    ->drupalCreateUser(array());
  $this
    ->drupalLogin($test_user);
  $this
    ->drupalGet('node/' . $this->node1->nid);
  $this
    ->assertNoRaw($this->node4->title, 'Node 4 title is not found');

  // As we have asserted Node 4 title not being on the page the only way this
  // click can succeed if the field formatter put it there.
  $test_user = $this
    ->drupalCreateUser(array(
    'access relations',
  ));
  $this
    ->drupalLogin($test_user);
  $this
    ->drupalGet('node/' . $this->node1->nid);
  $this
    ->clickLink($this->node4->title);
}