Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / user / tests / src / Functional / UserEditTest.php
index 0f75ff8dc58046c6d3fd8a3f1d612c40d81be5cd..5cdbc19f0506bb1d755a77d514e2ecb5a87fa03a 100644 (file)
@@ -2,6 +2,7 @@
 
 namespace Drupal\Tests\user\Functional;
 
+use Drupal\Core\Cache\Cache;
 use Drupal\Tests\BrowserTestBase;
 
 /**
@@ -29,9 +30,15 @@ class UserEditTest extends BrowserTestBase {
     // is the raw value and not a formatted one.
     \Drupal::state()->set('user_hooks_test_user_format_name_alter', TRUE);
     \Drupal::service('module_installer')->install(['user_hooks_test']);
+    Cache::invalidateTags(['rendered']);
     $this->drupalGet('user/' . $user1->id() . '/edit');
     $this->assertFieldByName('name', $user1->getAccountName());
 
+    // Ensure the formatted name is displayed when expected.
+    $this->drupalGet('user/' . $user1->id());
+    $this->assertSession()->responseContains($user1->getDisplayName());
+    $this->assertSession()->titleEquals(strip_tags($user1->getDisplayName()) . ' | Drupal');
+
     // Check that filling out a single password field does not validate.
     $edit = [];
     $edit['pass[pass1]'] = '';