Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal
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
drupal
Commits
092cf97b
Verified
Commit
092cf97b
authored
7 months ago
by
Théodore Biadala
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3469824
by catch, smustgrave: CommentTestBase/CommentTestTrait methods should be protected
(cherry picked from commit
5d987941
)
parent
1bdf2bda
No related branches found
No related tags found
2 merge requests
!11185
Issue #3477324 by andypost, alexpott: Fix usage of str_getcsv() and fgetcsv() for PHP 8.4
,
!9944
Issue #3483353: Consider making the createCopy config action optionally fail...
Pipeline
#265848
passed with warnings
7 months ago
Stage: 🪄 Lint
Stage: 🗜️ Test
Pipeline: drupal
#265867
Pipeline: drupal
#265858
Pipeline: drupal
#265853
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
core/modules/comment/src/Tests/CommentTestTrait.php
+1
-1
1 addition, 1 deletion
core/modules/comment/src/Tests/CommentTestTrait.php
core/modules/comment/tests/src/Functional/CommentTestBase.php
+12
-12
12 additions, 12 deletions
.../modules/comment/tests/src/Functional/CommentTestBase.php
with
13 additions
and
13 deletions
core/modules/comment/src/Tests/CommentTestTrait.php
+
1
−
1
View file @
092cf97b
...
...
@@ -33,7 +33,7 @@ trait CommentTestTrait {
* (optional) The comment view mode to be used in comment field formatter.
* Defaults to 'full'.
*/
p
ublic
function
addDefaultCommentField
(
$entity_type
,
$bundle
,
$field_name
=
'comment'
,
$default_value
=
CommentItemInterface
::
OPEN
,
$comment_type_id
=
'comment'
,
$comment_view_mode
=
'full'
)
{
p
rotected
function
addDefaultCommentField
(
$entity_type
,
$bundle
,
$field_name
=
'comment'
,
$default_value
=
CommentItemInterface
::
OPEN
,
$comment_type_id
=
'comment'
,
$comment_view_mode
=
'full'
)
{
$entity_type_manager
=
\Drupal
::
entityTypeManager
();
$entity_display_repository
=
\Drupal
::
service
(
'entity_display.repository'
);
/** @var \Drupal\Core\Entity\EntityFieldManagerInterface $entity_field_manager */
...
...
This diff is collapsed.
Click to expand it.
core/modules/comment/tests/src/Functional/CommentTestBase.php
+
12
−
12
View file @
092cf97b
...
...
@@ -120,7 +120,7 @@ protected function setUp(): void {
* @return \Drupal\comment\CommentInterface|null
* The posted comment or NULL when posted comment was not found.
*/
p
ublic
function
postComment
(
$entity
,
$comment
,
$subject
=
''
,
$contact
=
NULL
,
$field_name
=
'comment'
)
{
p
rotected
function
postComment
(
$entity
,
$comment
,
$subject
=
''
,
$contact
=
NULL
,
$field_name
=
'comment'
)
{
$edit
=
[];
$edit
[
'comment_body[0][value]'
]
=
$comment
;
...
...
@@ -201,7 +201,7 @@ public function postComment($entity, $comment, $subject = '', $contact = NULL, $
* @return bool
* Boolean indicating whether the comment was found.
*/
p
ublic
function
commentExists
(
?CommentInterface
$comment
=
NULL
,
$reply
=
FALSE
)
{
p
rotected
function
commentExists
(
?CommentInterface
$comment
=
NULL
,
$reply
=
FALSE
)
{
if
(
$comment
)
{
$comment_element
=
$this
->
cssSelect
((
$reply
?
'.indented '
:
''
)
.
'article#comment-'
.
$comment
->
id
());
if
(
empty
(
$comment_element
))
{
...
...
@@ -231,7 +231,7 @@ public function commentExists(?CommentInterface $comment = NULL, $reply = FALSE)
* @param \Drupal\comment\CommentInterface $comment
* Comment to delete.
*/
p
ublic
function
deleteComment
(
CommentInterface
$comment
)
{
p
rotected
function
deleteComment
(
CommentInterface
$comment
)
{
$this
->
drupalGet
(
'comment/'
.
$comment
->
id
()
.
'/delete'
);
$this
->
submitForm
([],
'Delete'
);
$this
->
assertSession
()
->
pageTextContains
(
'The comment and all its replies have been deleted.'
);
...
...
@@ -243,7 +243,7 @@ public function deleteComment(CommentInterface $comment) {
* @param bool $enabled
* Boolean specifying whether the subject field should be enabled.
*/
p
ublic
function
setCommentSubject
(
$enabled
)
{
p
rotected
function
setCommentSubject
(
$enabled
)
{
$form_display
=
$this
->
container
->
get
(
'entity_display.repository'
)
->
getFormDisplay
(
'comment'
,
'comment'
);
...
...
@@ -267,7 +267,7 @@ public function setCommentSubject($enabled) {
* (optional) Field name through which the comment should be posted.
* Defaults to 'comment'.
*/
p
ublic
function
setCommentPreview
(
$mode
,
$field_name
=
'comment'
)
{
p
rotected
function
setCommentPreview
(
$mode
,
$field_name
=
'comment'
)
{
switch
(
$mode
)
{
case
DRUPAL_DISABLED
:
$mode_text
=
'disabled'
;
...
...
@@ -294,7 +294,7 @@ public function setCommentPreview($mode, $field_name = 'comment') {
* (optional) Field name through which the comment should be posted.
* Defaults to 'comment'.
*/
p
ublic
function
setCommentForm
(
$enabled
,
$field_name
=
'comment'
)
{
p
rotected
function
setCommentForm
(
$enabled
,
$field_name
=
'comment'
)
{
$this
->
setCommentSettings
(
'form_location'
,
(
$enabled
?
CommentItemInterface
::
FORM_BELOW
:
CommentItemInterface
::
FORM_SEPARATE_PAGE
),
'Comment controls '
.
(
$enabled
?
'enabled'
:
'disabled'
)
.
'.'
,
$field_name
);
}
...
...
@@ -307,7 +307,7 @@ public function setCommentForm($enabled, $field_name = 'comment') {
* - 1: Contact information allowed but not required.
* - 2: Contact information required.
*/
p
ublic
function
setCommentAnonymous
(
$level
)
{
p
rotected
function
setCommentAnonymous
(
$level
)
{
$this
->
setCommentSettings
(
'anonymous'
,
$level
,
new
FormattableMarkup
(
'Anonymous commenting set to level @level.'
,
[
'@level'
=>
$level
]));
}
...
...
@@ -320,7 +320,7 @@ public function setCommentAnonymous($level) {
* (optional) Field name through which the comment should be posted.
* Defaults to 'comment'.
*/
p
ublic
function
setCommentsPerPage
(
$number
,
$field_name
=
'comment'
)
{
p
rotected
function
setCommentsPerPage
(
$number
,
$field_name
=
'comment'
)
{
$this
->
setCommentSettings
(
'per_page'
,
$number
,
new
FormattableMarkup
(
'Number of comments per page set to @number.'
,
[
'@number'
=>
$number
]),
$field_name
);
}
...
...
@@ -337,7 +337,7 @@ public function setCommentsPerPage($number, $field_name = 'comment') {
* (optional) Field name through which the comment should be posted.
* Defaults to 'comment'.
*/
p
ublic
function
setCommentSettings
(
$name
,
$value
,
$message
,
$field_name
=
'comment'
)
{
p
rotected
function
setCommentSettings
(
$name
,
$value
,
$message
,
$field_name
=
'comment'
)
{
$field
=
FieldConfig
::
loadByName
(
'node'
,
'article'
,
$field_name
);
$field
->
setSetting
(
$name
,
$value
);
$field
->
save
();
...
...
@@ -349,7 +349,7 @@ public function setCommentSettings($name, $value, $message, $field_name = 'comme
* @return bool
* Contact info is available.
*/
p
ublic
function
commentContactInfoAvailable
()
{
p
rotected
function
commentContactInfoAvailable
()
{
return
(
bool
)
preg_match
(
'/(input).*?(name="name").*?(input).*?(name="mail").*?(input).*?(name="homepage")/s'
,
$this
->
getSession
()
->
getPage
()
->
getContent
());
}
...
...
@@ -363,7 +363,7 @@ public function commentContactInfoAvailable() {
* @param bool $approval
* Operation is found on approval page.
*/
p
ublic
function
performCommentOperation
(
CommentInterface
$comment
,
$operation
,
$approval
=
FALSE
)
{
p
rotected
function
performCommentOperation
(
CommentInterface
$comment
,
$operation
,
$approval
=
FALSE
)
{
$edit
=
[];
$edit
[
'operation'
]
=
$operation
;
$edit
[
'comments['
.
$comment
->
id
()
.
']'
]
=
TRUE
;
...
...
@@ -388,7 +388,7 @@ public function performCommentOperation(CommentInterface $comment, $operation, $
* @return int
* Comment id.
*/
p
ublic
function
getUnapprovedComment
(
$subject
)
{
p
rotected
function
getUnapprovedComment
(
$subject
)
{
$this
->
drupalGet
(
'admin/content/comment/approval'
);
preg_match
(
'/href="(.*?)#comment-([^"]+)"(.*?)>('
.
$subject
.
')/'
,
$this
->
getSession
()
->
getPage
()
->
getContent
(),
$match
);
...
...
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