diff --git a/tests/src/Functional/GroupTabTest.php b/tests/src/Functional/GroupTabTest.php index 65aafc709..30d61e872 100644 --- a/tests/src/Functional/GroupTabTest.php +++ b/tests/src/Functional/GroupTabTest.php @@ -26,13 +26,6 @@ class GroupTabTest extends BrowserTestBase { */ protected $group; - /** - * Test entity group. - * - * @var \Drupal\node\NodeInterface - */ - protected $nonGroup; - /** * A group bundle name. * @@ -82,24 +75,19 @@ protected function setUp() { Og::groupTypeManager()->addGroup('node', $this->bundle1); // Create node author user. - $user = $this->createUser(); + $this->user1 = $this->drupalCreateUser(['administer group']); + + // Create normal user. + $this->user2 = $this->drupalCreateUser(['access content']); // Create nodes. $this->group = Node::create([ 'type' => $this->bundle1, 'title' => $this->randomString(), - 'uid' => $user->id(), + 'uid' => $this->user1->id(), ]); $this->group->save(); - $this->nonGroup = Node::create([ - 'type' => $this->bundle2, - 'title' => $this->randomString(), - 'uid' => $user->id(), - ]); - $this->nonGroup->save(); - - $this->user1 = $this->drupalCreateUser(['administer group']); } /** @@ -109,8 +97,11 @@ public function testGroupTab() { $this->drupalLogin($this->user1); $this->drupalGet('group/node/' . $this->group->id() . '/admin'); $this->assertResponse(200); + $this->drupalLogout(); + } - $this->drupalGet('group/node/' . $this->nonGroup->id() . '/admin'); + public function testGroupTabAccessDenied() { + $this->drupalGet('group/node/' . $this->group->id() . '/admin'); $this->assertResponse(403); }