Skip to content
Snippets Groups Projects
Verified Commit a5186f55 authored by Théodore Biadala's avatar Théodore Biadala
Browse files

Issue #3469824 by catch, smustgrave: CommentTestBase/CommentTestTrait methods should be protected

(cherry picked from commit 5d987941)
parent 11b11275
No related branches found
No related tags found
17 merge requests!10663Issue #3495778: Update phpdoc in FileSaveHtaccessLoggingTest,!10451Issue #3472458 by watergate, smustgrave: CKEditor 5 show blocks label is not translated,!103032838547 Fix punctuation rules for inline label suffix colon with CSS only,!10150Issue #3467294 by quietone, nod_, smustgrave, catch, longwave: Change string...,!10130Resolve #3480321 "Second level menu",!9936Issue #3483087: Check the module:// prefix in the translation server path and replace it with the actual module path,!9933Issue #3394728 by ankondrat4: Undefined array key "#prefix" and deprecated function: explode() in Drupal\file\Element\ManagedFile::uploadAjaxCallback(),!9914Issue #3451136 by quietone, gapple, ghost of drupal past: Improve...,!9882Draft: Issue #3481777 In bulk_form ensure the triggering element is the bulk_form button,!9839Issue #3445469 by pooja_sharma, smustgrave: Add additional test coverage for...,!9815Issue #3480025: There is no way to remove entity cache items,!9757Issue #3478869 Add "All" or overview links to parent links,!9752Issue #3439910 by pooja_sharma, vensires: Fix Toolbar tests that rely on UID1's super user behavior,!9749Issue #3439910 by pooja_sharma, vensires: Fix Toolbar tests that rely on UID1's super user behavior,!9678Issue #3465132 by catch, Spokje, nod_: Show test run time by class in run-tests.sh output,!9578Issue #3304746 by scott_euser, casey, smustgrave: BigPipe cannot handle (GET)...,!9449Issue #3344041: Allow textarea widgets to be used for text (formatted) fields
Pipeline #265864 canceled
Pipeline: drupal

#265866

    ......@@ -33,7 +33,7 @@ trait CommentTestTrait {
    * (optional) The comment view mode to be used in comment field formatter.
    * Defaults to 'full'.
    */
    public function addDefaultCommentField($entity_type, $bundle, $field_name = 'comment', $default_value = CommentItemInterface::OPEN, $comment_type_id = 'comment', $comment_view_mode = 'full') {
    protected 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 */
    ......
    ......@@ -120,7 +120,7 @@ protected function setUp(): void {
    * @return \Drupal\comment\CommentInterface|null
    * The posted comment or NULL when posted comment was not found.
    */
    public function postComment($entity, $comment, $subject = '', $contact = NULL, $field_name = 'comment') {
    protected 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.
    */
    public function commentExists(?CommentInterface $comment = NULL, $reply = FALSE) {
    protected 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.
    */
    public function deleteComment(CommentInterface $comment) {
    protected 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.
    */
    public function setCommentSubject($enabled) {
    protected 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'.
    */
    public function setCommentPreview($mode, $field_name = 'comment') {
    protected 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'.
    */
    public function setCommentForm($enabled, $field_name = 'comment') {
    protected 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.
    */
    public function setCommentAnonymous($level) {
    protected 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'.
    */
    public function setCommentsPerPage($number, $field_name = 'comment') {
    protected 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'.
    */
    public function setCommentSettings($name, $value, $message, $field_name = 'comment') {
    protected 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.
    */
    public function commentContactInfoAvailable() {
    protected 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.
    */
    public function performCommentOperation(CommentInterface $comment, $operation, $approval = FALSE) {
    protected 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.
    */
    public function getUnapprovedComment($subject) {
    protected function getUnapprovedComment($subject) {
    $this->drupalGet('admin/content/comment/approval');
    preg_match('/href="(.*?)#comment-([^"]+)"(.*?)>(' . $subject . ')/', $this->getSession()->getPage()->getContent(), $match);
    ......
    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