Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
config_readonly
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
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
project
config_readonly
Commits
eef01835
Commit
eef01835
authored
10 months ago
by
Jakob P
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#2910445
by pfrenssen: Add a warning to the status report if config is writable
parent
633853ad
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!16
Resolve #2910445 "Add a warning"
Pipeline
#214358
canceled
10 months ago
Stage: build
Stage: validate
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
config_readonly.install
+36
-0
36 additions, 0 deletions
config_readonly.install
tests/src/Functional/ReadOnlyConfigTest.php
+20
-0
20 additions, 0 deletions
tests/src/Functional/ReadOnlyConfigTest.php
with
56 additions
and
0 deletions
config_readonly.install
0 → 100644
+
36
−
0
View file @
eef01835
<?php
/**
* @file
* Install, uninstall, requirements and schema hooks for Config Read-only mode.
*/
use
Drupal\Core\Site\Settings
;
/**
* Implements hook_requirements().
*/
function
config_readonly_requirements
(
$phase
)
{
$requirements
=
[];
if
(
$phase
==
'runtime'
)
{
if
(
!
Settings
::
get
(
'config_readonly'
))
{
$requirements
[
'config_readonly'
]
=
[
'title'
=>
t
(
'Config Read-only mode'
),
'description'
=>
t
(
'The Config Read-only module is enabled but not active.'
),
'severity'
=>
REQUIREMENT_WARNING
,
'value'
=>
t
(
'Config is writable'
),
];
}
else
{
$requirements
[
'config_readonly'
]
=
[
'title'
=>
t
(
'Config Read-only mode'
),
'description'
=>
t
(
'The Config Read-only module is enabled and active.'
),
'severity'
=>
REQUIREMENT_INFO
,
'value'
=>
t
(
'Config is readonly'
),
];
}
}
return
$requirements
;
}
This diff is collapsed.
Click to expand it.
tests/src/Functional/ReadOnlyConfigTest.php
+
20
−
0
View file @
eef01835
...
...
@@ -141,4 +141,24 @@ class ReadOnlyConfigTest extends ReadOnlyConfigTestBase {
$this
->
assertSession
()
->
pageTextContains
(
$this
->
message
);
}
/**
* Test the status page to ensure the correct message is displayed.
*
* @see https://www.drupal.org/project/config_readonly/issues/2910445
*/
public
function
testModuleStatusPage
()
{
// Verify if we can successfully access file system route.
$status_url
=
Url
::
fromRoute
(
'system.status'
);
$this
->
drupalGet
(
$status_url
);
$this
->
assertSession
()
->
statusCodeEquals
(
200
);
// Status page displays REQUIREMENT_WARNING because read-only is disabled.
$this
->
assertSession
()
->
pageTextContains
(
"The Config Read-only module is enabled but not active."
);
// Switch forms to read-only.
$this
->
turnOnReadOnlySetting
();
$this
->
drupalGet
(
$status_url
);
// Status page displays REQUIREMENT_INFO because read-only is enabled.
$this
->
assertSession
()
->
pageTextContains
(
"The Config Read-only module is enabled and active."
);
}
}
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