@@ -26,13 +26,6 @@ class GroupTabTest extends BrowserTestBase {
2626 */
2727 protected $ group ;
2828
29- /**
30- * Test entity group.
31- *
32- * @var \Drupal\node\NodeInterface
33- */
34- protected $ nonGroup ;
35-
3629 /**
3730 * A group bundle name.
3831 *
@@ -82,24 +75,19 @@ protected function setUp() {
8275 Og::groupTypeManager ()->addGroup ('node ' , $ this ->bundle1 );
8376
8477 // Create node author user.
85- $ user = $ this ->createUser ();
78+ $ this ->user1 = $ this ->drupalCreateUser (['administer group ' ]);
79+
80+ // Create normal user.
81+ $ this ->user2 = $ this ->drupalCreateUser (['access content ' ]);
8682
8783 // Create nodes.
8884 $ this ->group = Node::create ([
8985 'type ' => $ this ->bundle1 ,
9086 'title ' => $ this ->randomString (),
91- 'uid ' => $ user ->id (),
87+ 'uid ' => $ this -> user1 ->id (),
9288 ]);
9389 $ this ->group ->save ();
9490
95- $ this ->nonGroup = Node::create ([
96- 'type ' => $ this ->bundle2 ,
97- 'title ' => $ this ->randomString (),
98- 'uid ' => $ user ->id (),
99- ]);
100- $ this ->nonGroup ->save ();
101-
102- $ this ->user1 = $ this ->drupalCreateUser (['administer group ' ]);
10391 }
10492
10593 /**
@@ -109,8 +97,11 @@ public function testGroupTab() {
10997 $ this ->drupalLogin ($ this ->user1 );
11098 $ this ->drupalGet ('group/node/ ' . $ this ->group ->id () . '/admin ' );
11199 $ this ->assertResponse (200 );
100+ $ this ->drupalLogout ();
101+ }
112102
113- $ this ->drupalGet ('group/node/ ' . $ this ->nonGroup ->id () . '/admin ' );
103+ public function testGroupTabAccessDenied () {
104+ $ this ->drupalGet ('group/node/ ' . $ this ->group ->id () . '/admin ' );
114105 $ this ->assertResponse (403 );
115106 }
116107
0 commit comments