diff --git a/core/modules/node/src/Tests/NodeAccessJoinTest.php b/core/modules/node/src/Tests/NodeAccessJoinTest.php index 8896d63..a1a30c9 100644 --- a/core/modules/node/src/Tests/NodeAccessJoinTest.php +++ b/core/modules/node/src/Tests/NodeAccessJoinTest.php @@ -248,6 +248,37 @@ public function testNodeAccessJoin() { } } } + + // The above code doesn't create pages for a reference to a private article + // chained to a reference to an author private article. We create those + // pages now. + $edit = [ + 'title' => 'private article - author private', + 'type' => 'article', + ]; + $edit['private'][0]['value'] = TRUE; + $edit['related_article'][0]['target_id'] = $this->articles['author no reference']['author private']; + $node = $this->drupalCreateNode($edit); + $this->articles['private']['author private'] = $node->id(); + + $edit['title'] = 'author private article - private'; + $edit['uid'] = $this->authorUser->id(); + $edit['related_article'][0]['target_id'] = $this->articles['no reference']['private']; + $node = $this->drupalCreateNode($edit); + $this->articles['author private']['private'] = $node->id(); + + // Now create the pages. + $edit = [ + 'type' => 'page', + 'title' => 'Page - author private - private', + ]; + $edit['related_article'][0]['target_id'] = $this->articles['author private']['private']; + $node = $this->drupalCreateNode($edit); + $edit['title'] = 'Page - private - author private'; + $edit['related_article'][0]['target_id'] = $this->articles['private']['author private']; + $this->drupalCreateNode($edit); + + $total += 2; $total_author += $total_public; ViewTestData::createTestViews(get_class($this), ['node_test_views']); @@ -264,7 +295,7 @@ public function testNodeAccessJoin() { $this->assertNoText('- private', "Node author doesn't see private nodes he's not the author of"); $this->assertText('Page - public - no reference', 'Node with public reference visible'); $rows = count($this->xpath("//td[@headers='view-title-table-column']")); - $this->assertTrue($rows == $total_author, "Author sees all rows he has access to. $rows - $total_author"); + $this->assertEqual($rows, $total_author, "Author sees all rows he has access to."); // User to check if entries with private references are hidden. $this->regularUser = $this->drupalCreateUser(['access content']); @@ -276,7 +307,7 @@ public function testNodeAccessJoin() { $this->assertText('Page - public - no reference', 'Node with public reference visible'); $this->assertText('Page - public - public', 'Node with 2 public joins visible'); $rows = count($this->xpath("//td[@headers='view-title-table-column']")); - $this->assertTrue($rows == $total_public, "User with no access sees only public rows."); + $this->assertEqual($rows, $total_public, "User with no access sees only public rows."); // User to check if entries with private references are visible. $this->accessUser = $this->drupalCreateUser(['access content', 'node test view']); @@ -284,7 +315,7 @@ public function testNodeAccessJoin() { $this->drupalGet('test-node-access-join'); $this->verbose('Viewing page with access user'); $rows = count($this->xpath("//td[@headers='view-title-table-column']")); - $this->assertTrue($rows == $total, "User with access sees all rows."); + $this->assertEqual($rows, $total, "User with access sees all rows."); }