Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
form_mode_manager-3297262
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Issue forks
form_mode_manager-3297262
Commits
bc7b35a5
Commit
bc7b35a5
authored
3 years ago
by
Derek Wright
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3224726
by dww: Add test coverage for
#3054902
parent
f48b4c09
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/src/Functional/FormModeManagerRouteTest.php
+19
-0
19 additions, 0 deletions
tests/src/Functional/FormModeManagerRouteTest.php
with
19 additions
and
0 deletions
tests/src/Functional/FormModeManagerRouteTest.php
+
19
−
0
View file @
bc7b35a5
...
...
@@ -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
);
}
/**
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment