function BookRelationshipTest::testRelationship

Same name in other branches
  1. 8.9.x core/modules/book/tests/src/Functional/Views/BookRelationshipTest.php \Drupal\Tests\book\Functional\Views\BookRelationshipTest::testRelationship()
  2. 10 core/modules/book/tests/src/Functional/Views/BookRelationshipTest.php \Drupal\Tests\book\Functional\Views\BookRelationshipTest::testRelationship()
  3. 11.x core/modules/book/tests/src/Functional/Views/BookRelationshipTest.php \Drupal\Tests\book\Functional\Views\BookRelationshipTest::testRelationship()

Tests using the views relationship.

File

core/modules/book/tests/src/Functional/Views/BookRelationshipTest.php, line 149

Class

BookRelationshipTest
Tests entity reference relationship data.

Namespace

Drupal\Tests\book\Functional\Views

Code

public function testRelationship() {
    // Create new book.
    
    /** @var \Drupal\node\NodeInterface[] $nodes */
    $nodes = $this->createBook();
    for ($i = 0; $i < 8; $i++) {
        $this->drupalGet('test-book/' . $nodes[$i]->id());
        for ($j = 0; $j < $i; $j++) {
            $this->assertSession()
                ->linkExists($nodes[$j]->label());
        }
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.