'Nodeaccess Grant Tab visibility', 'description' => 'Tests whether the Grant tab appears correctly..', 'group' => 'Nodeaccess', ); } /** * Make sure the 'Grant' tab is available from the node view when appropriate. * @test */ public function testGrantTabVisbility() { // Create a test user, and a node with nodeaccess enabled for its type. $user = $this->drupalCreateUser(array('grant node permissions')); $node = $this->drupalCreateNode(); nodeaccess_add_type_grant($node->type); // First, before logging in, we shouldn't see a link. $this->drupalGet("node/{$node->nid}"); $this->assertNoLinkByHref("node/{$node->nid}/grant"); // Log in and the grant tab should appear. $this->drupalLogin($user); $this->drupalGet("node/{$node->nid}"); $this->assertLinkByHref("node/{$node->nid}/grant"); // Disable nodeaccess for this content type, and the tab should be gone. nodeaccess_delete_type_grant($node->type); $this->drupalGet("node/{$node->nid}"); $this->assertNoLinkByHref("node/{$node->nid}/grant"); // Confirm that the anonymous user still doesn't see the grant tab. $this->drupalLogout(); $this->drupalGet("node/{$node->nid}"); $this->assertNoLinkByHref("node/{$node->nid}/grant"); } }