Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / comment / tests / src / Kernel / CommentFieldAccessTest.php
index 1e0fd72129dc7aa320262d49145ad4e8a83d2c88..c17f247dff0b6df2dd39fb8d3a97f1a1b582e0a3 100644 (file)
@@ -5,7 +5,7 @@ namespace Drupal\Tests\comment\Kernel;
 use Drupal\comment\Entity\Comment;
 use Drupal\comment\Entity\CommentType;
 use Drupal\comment\Tests\CommentTestTrait;
-use Drupal\Component\Utility\SafeMarkup;
+use Drupal\Component\Render\FormattableMarkup;
 use Drupal\Core\Session\AnonymousUserSession;
 use Drupal\entity_test\Entity\EntityTest;
 use Drupal\field\Entity\FieldConfig;
@@ -202,7 +202,7 @@ class CommentFieldAccessTest extends EntityKernelTestBase {
     // Generate permutations.
     $combinations = [
       'comment' => [$comment1, $comment2, $comment3, $comment4],
-      'user' => [$comment_admin_user, $comment_enabled_user, $comment_no_edit_user, $comment_disabled_user, $anonymous_user]
+      'user' => [$comment_admin_user, $comment_enabled_user, $comment_no_edit_user, $comment_disabled_user, $anonymous_user],
     ];
     $permutations = $this->generatePermutations($combinations);
 
@@ -211,12 +211,12 @@ class CommentFieldAccessTest extends EntityKernelTestBase {
       foreach ($permutations as $set) {
         $may_view = $set['comment']->{$field}->access('view', $set['user']);
         $may_update = $set['comment']->{$field}->access('edit', $set['user']);
-        $this->assertTrue($may_view, SafeMarkup::format('User @user can view field @field on comment @comment', [
+        $this->assertTrue($may_view, new FormattableMarkup('User @user can view field @field on comment @comment', [
           '@user' => $set['user']->getUsername(),
           '@comment' => $set['comment']->getSubject(),
           '@field' => $field,
         ]));
-        $this->assertEqual($may_update, $set['user']->hasPermission('administer comments'), SafeMarkup::format('User @user @state update field @field on comment @comment', [
+        $this->assertEqual($may_update, $set['user']->hasPermission('administer comments'), new FormattableMarkup('User @user @state update field @field on comment @comment', [
           '@user' => $set['user']->getUsername(),
           '@state' => $may_update ? 'can' : 'cannot',
           '@comment' => $set['comment']->getSubject(),
@@ -228,7 +228,7 @@ class CommentFieldAccessTest extends EntityKernelTestBase {
     // Check access to normal field.
     foreach ($permutations as $set) {
       $may_update = $set['comment']->access('update', $set['user']) && $set['comment']->subject->access('edit', $set['user']);
-      $this->assertEqual($may_update, $set['user']->hasPermission('administer comments') || ($set['user']->hasPermission('edit own comments') && $set['user']->id() == $set['comment']->getOwnerId()), SafeMarkup::format('User @user @state update field subject on comment @comment', [
+      $this->assertEqual($may_update, $set['user']->hasPermission('administer comments') || ($set['user']->hasPermission('edit own comments') && $set['user']->id() == $set['comment']->getOwnerId()), new FormattableMarkup('User @user @state update field subject on comment @comment', [
         '@user' => $set['user']->getUsername(),
         '@state' => $may_update ? 'can' : 'cannot',
         '@comment' => $set['comment']->getSubject(),
@@ -250,13 +250,13 @@ class CommentFieldAccessTest extends EntityKernelTestBase {
           $view_access = TRUE;
           $state = 'can';
         }
-        $this->assertEqual($may_view, $view_access, SafeMarkup::format('User @user @state view field @field on comment @comment', [
+        $this->assertEqual($may_view, $view_access, new FormattableMarkup('User @user @state view field @field on comment @comment', [
           '@user' => $set['user']->getUsername(),
           '@comment' => $set['comment']->getSubject(),
           '@field' => $field,
           '@state' => $state,
         ]));
-        $this->assertFalse($may_update, SafeMarkup::format('User @user @state update field @field on comment @comment', [
+        $this->assertFalse($may_update, new FormattableMarkup('User @user @state update field @field on comment @comment', [
           '@user' => $set['user']->getUsername(),
           '@state' => $may_update ? 'can' : 'cannot',
           '@comment' => $set['comment']->getSubject(),
@@ -271,12 +271,12 @@ class CommentFieldAccessTest extends EntityKernelTestBase {
       foreach ($permutations as $set) {
         $may_view = $set['comment']->{$field}->access('view', $set['user']);
         $may_update = $set['comment']->{$field}->access('edit', $set['user']);
-        $this->assertEqual($may_view, TRUE, SafeMarkup::format('User @user can view field @field on comment @comment', [
+        $this->assertEqual($may_view, TRUE, new FormattableMarkup('User @user can view field @field on comment @comment', [
           '@user' => $set['user']->getUsername(),
           '@comment' => $set['comment']->getSubject(),
           '@field' => $field,
         ]));
-        $this->assertEqual($may_update, $set['user']->hasPermission('post comments') && $set['comment']->isNew(), SafeMarkup::format('User @user @state update field @field on comment @comment', [
+        $this->assertEqual($may_update, $set['user']->hasPermission('post comments') && $set['comment']->isNew(), new FormattableMarkup('User @user @state update field @field on comment @comment', [
           '@user' => $set['user']->getUsername(),
           '@state' => $may_update ? 'can' : 'cannot',
           '@comment' => $set['comment']->getSubject(),
@@ -298,7 +298,7 @@ class CommentFieldAccessTest extends EntityKernelTestBase {
             $set['comment']->isNew() &&
             $set['user']->hasPermission('post comments') &&
             $set['comment']->getFieldName() == 'comment_other'
-          ), SafeMarkup::format('User @user @state update field @field on comment @comment', [
+          ), new FormattableMarkup('User @user @state update field @field on comment @comment', [
           '@user' => $set['user']->getUsername(),
           '@state' => $may_update ? 'can' : 'cannot',
           '@comment' => $set['comment']->getSubject(),