Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / comment / tests / src / Functional / CommentPagerTest.php
similarity index 96%
rename from web/core/modules/comment/src/Tests/CommentPagerTest.php
rename to web/core/modules/comment/tests/src/Functional/CommentPagerTest.php
index 48326bca6e459ba63fbec15d956a51f34afe58ef..9cbc61dbe1a40695881a7fb019a89eac2157c0e0 100644 (file)
@@ -1,9 +1,9 @@
 <?php
 
-namespace Drupal\comment\Tests;
+namespace Drupal\Tests\comment\Functional;
 
 use Drupal\comment\CommentManagerInterface;
-use Drupal\Component\Utility\SafeMarkup;
+use Drupal\Component\Render\FormattableMarkup;
 use Drupal\node\Entity\Node;
 
 /**
@@ -12,6 +12,7 @@ use Drupal\node\Entity\Node;
  * @group comment
  */
 class CommentPagerTest extends CommentTestBase {
+
   /**
    * Confirms comment paging works correctly with flat and threaded comments.
    */
@@ -216,7 +217,7 @@ class CommentPagerTest extends CommentTestBase {
     $comment_anchors = $this->xpath('//a[starts-with(@id,"comment-")]');
     $result_order = [];
     foreach ($comment_anchors as $anchor) {
-      $result_order[] = substr($anchor['id'], 8);
+      $result_order[] = substr($anchor->getAttribute('id'), 8);
     }
     return $this->assertEqual($expected_cids, $result_order, format_string('Comment order: expected @expected, returned @returned.', ['@expected' => implode(',', $expected_cids), '@returned' => implode(',', $result_order)]));
   }
@@ -328,7 +329,7 @@ class CommentPagerTest extends CommentTestBase {
         'settings' => [
           'pager_id' => 1,
           'view_mode' => 'default',
-        ]
+        ],
       ])
       ->save();
 
@@ -338,12 +339,12 @@ class CommentPagerTest extends CommentTestBase {
     $this->drupalGet('admin/structure/types/manage/article/display');
     $this->assertNoText(t('Pager ID: @id', ['@id' => 0]), 'No summary for standard pager');
     $this->assertText(t('Pager ID: @id', ['@id' => 1]));
-    $this->drupalPostAjaxForm(NULL, [], 'comment_settings_edit');
+    $this->drupalPostForm(NULL, [], 'comment_settings_edit');
     // Change default pager to 2.
     $this->drupalPostForm(NULL, ['fields[comment][settings_edit_form][settings][pager_id]' => 2], t('Save'));
     $this->assertText(t('Pager ID: @id', ['@id' => 2]));
     // Revert the changes.
-    $this->drupalPostAjaxForm(NULL, [], 'comment_settings_edit');
+    $this->drupalPostForm(NULL, [], 'comment_settings_edit');
     $this->drupalPostForm(NULL, ['fields[comment][settings_edit_form][settings][pager_id]' => 0], t('Save'));
     $this->assertNoText(t('Pager ID: @id', ['@id' => 0]), 'No summary for standard pager');
 
@@ -421,11 +422,11 @@ class CommentPagerTest extends CommentTestBase {
     $url_before = $this->getUrl();
     $urls = $this->xpath($xpath, $arguments);
     if (isset($urls[$index])) {
-      $url_target = $this->getAbsoluteUrl($urls[$index]['href']);
-      $this->pass(SafeMarkup::format('Clicked link %label (@url_target) from @url_before', ['%label' => $xpath, '@url_target' => $url_target, '@url_before' => $url_before]), 'Browser');
+      $url_target = $this->getAbsoluteUrl($urls[$index]->getAttribute('href'));
+      $this->pass(new FormattableMarkup('Clicked link %label (@url_target) from @url_before', ['%label' => $xpath, '@url_target' => $url_target, '@url_before' => $url_before]), 'Browser');
       return $this->drupalGet($url_target);
     }
-    $this->fail(SafeMarkup::format('Link %label does not exist on @url_before', ['%label' => $xpath, '@url_before' => $url_before]), 'Browser');
+    $this->fail(new FormattableMarkup('Link %label does not exist on @url_before', ['%label' => $xpath, '@url_before' => $url_before]), 'Browser');
     return FALSE;
   }