Skip to content
Snippets Groups Projects
Commit bc7b35a5 authored by Derek Wright's avatar Derek Wright
Browse files

Issue #3224726 by dww: Add test coverage for #3054902

parent f48b4c09
No related branches found
No related tags found
No related merge requests found
......@@ -24,6 +24,12 @@ class FormModeManagerRouteTest extends FormModeManagerBase {
public function testAnonymousSpecificFormModeManagerRoutes() {
$node_form_mode_id = $this->formModeManager->getFormModeMachineName($this->nodeFormMode->id());
$node_type_test_page = $this->drupalCreateContentType([
'type' => 'test_page',
'name' => 'Test Page',
]);
$this->setUpFormMode("admin/structure/types/manage/test_page/form-display", $this->nodeFormMode->id());
$this->drupalLogin($this->anonymousUser);
Role::load($this->anonymousUser->getRoles()[1])
->grantPermission("use {$this->nodeFormMode->id()} form mode")
......@@ -52,6 +58,19 @@ class FormModeManagerRouteTest extends FormModeManagerBase {
// Edit a node with default form mode not available.
$this->drupalGet("node/{$this->node1->id()}/edit");
$this->assertSession()->statusCodeEquals(403);
// Make sure we can't add test_page content as this "anonymous" user.
$this->drupalGet("node/add/test_page");
$this->assertSession()->statusCodeEquals(403);
// Even if using a specific form mode.
$this->drupalGet("node/add/test_page/{$node_form_mode_id}");
$this->assertSession()->statusCodeEquals(403);
$this->drupalLogin($this->rootUser);
$this->drupalGet("node/add/test_page");
$this->assertSession()->statusCodeEquals(200);
$this->drupalGet("node/add/test_page/{$node_form_mode_id}");
$this->assertSession()->statusCodeEquals(200);
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment