Updated to Drupal 8.6.4, which is PHP 7.3 friendly. Also updated HTMLaw library....
[yaffs-website] / web / core / modules / filter / tests / src / Functional / FilterAdminTest.php
index 21431e7969a341f0f284d352f32d163215027aa0..d6327688ef031e461d052ca2daf1137386645292 100644 (file)
@@ -3,7 +3,7 @@
 namespace Drupal\Tests\filter\Functional;
 
 use Drupal\Component\Utility\Html;
-use Drupal\Component\Utility\Unicode;
+use Drupal\Core\Url;
 use Drupal\filter\Entity\FilterFormat;
 use Drupal\node\Entity\Node;
 use Drupal\node\Entity\NodeType;
@@ -114,7 +114,7 @@ class FilterAdminTest extends BrowserTestBase {
     // Add text format.
     $this->drupalGet('admin/config/content/formats');
     $this->clickLink('Add text format');
-    $format_id = Unicode::strtolower($this->randomMachineName());
+    $format_id = mb_strtolower($this->randomMachineName());
     $name = $this->randomMachineName();
     $edit = [
       'format' => $format_id,
@@ -135,16 +135,9 @@ class FilterAdminTest extends BrowserTestBase {
 
     // Edit text format.
     $this->drupalGet('admin/config/content/formats');
-    // Cannot use the assertNoLinkByHref method as it does partial url matching
-    // and 'admin/config/content/formats/manage/' . $format_id . '/disable'
-    // exists.
-    // @todo: See https://www.drupal.org/node/2031223 for the above.
-    $edit_link = $this->xpath('//a[@href=:href]', [
-      ':href' => \Drupal::url('entity.filter_format.edit_form', ['filter_format' => $format_id])
-    ]);
-    $this->assertNotEmpty($edit_link, format_string('Link href %href found.',
-      ['%href' => 'admin/config/content/formats/manage/' . $format_id]
-    ));
+    $destination = Url::fromRoute('filter.admin_overview')->toString();
+    $edit_href = Url::fromRoute('entity.filter_format.edit_form', ['filter_format' => $format_id], ['query' => ['destination' => $destination]])->toString();
+    $this->assertSession()->linkByHrefExists($edit_href);
     $this->drupalGet('admin/config/content/formats/manage/' . $format_id);
     $this->drupalPostForm(NULL, [], t('Save configuration'));
 
@@ -247,7 +240,7 @@ class FilterAdminTest extends BrowserTestBase {
 
     // Add format.
     $edit = [];
-    $edit['format'] = Unicode::strtolower($this->randomMachineName());
+    $edit['format'] = mb_strtolower($this->randomMachineName());
     $edit['name'] = $this->randomMachineName();
     $edit['roles[' . RoleInterface::AUTHENTICATED_ID . ']'] = 1;
     $edit['filters[' . $second_filter . '][status]'] = TRUE;
@@ -395,14 +388,14 @@ class FilterAdminTest extends BrowserTestBase {
    */
   public function testDisabledFormat() {
     // Create a node type and add a standard body field.
-    $node_type = NodeType::create(['type' => Unicode::strtolower($this->randomMachineName())]);
+    $node_type = NodeType::create(['type' => mb_strtolower($this->randomMachineName())]);
     $node_type->save();
     node_add_body_field($node_type, $this->randomString());
 
     // Create a text format with a filter that returns a static string.
     $format = FilterFormat::create([
       'name' => $this->randomString(),
-      'format' => $format_id = Unicode::strtolower($this->randomMachineName()),
+      'format' => $format_id = mb_strtolower($this->randomMachineName()),
     ]);
     $format->setFilterConfig('filter_static_text', ['status' => TRUE]);
     $format->save();