Updated to Drupal 8.6.4, which is PHP 7.3 friendly. Also updated HTMLaw library....
[yaffs-website] / web / core / modules / block_content / tests / src / Functional / BlockContentCreationTest.php
index 562a4bd102ff067c2fe3e2f31e1dfb924c4bc95a..46768d694b249bee1a1e74a992023f129a95ddc3 100644 (file)
@@ -3,7 +3,6 @@
 namespace Drupal\Tests\block_content\Functional;
 
 use Drupal\block_content\Entity\BlockContent;
-use Drupal\Component\Utility\Unicode;
 use Drupal\Core\Database\Database;
 
 /**
@@ -30,7 +29,7 @@ class BlockContentCreationTest extends BlockContentTestBase {
    */
   protected $permissions = [
     'administer blocks',
-    'administer block_content display'
+    'administer block_content display',
   ];
 
   /**
@@ -56,14 +55,16 @@ class BlockContentCreationTest extends BlockContentTestBase {
     // Check that the Basic block has been created.
     $this->assertRaw(format_string('@block %name has been created.', [
       '@block' => 'basic',
-      '%name' => $edit['info[0][value]']
+      '%name' => $edit['info[0][value]'],
     ]), 'Basic block created.');
 
     // Check that the view mode setting is hidden because only one exists.
     $this->assertNoFieldByXPath('//select[@name="settings[view_mode]"]', NULL, 'View mode setting hidden because only one exists');
 
     // Check that the block exists in the database.
-    $blocks = entity_load_multiple_by_properties('block_content', ['info' => $edit['info[0][value]']]);
+    $blocks = \Drupal::entityTypeManager()
+      ->getStorage('block_content')
+      ->loadByProperties(['info' => $edit['info[0][value]']]);
     $block = reset($blocks);
     $this->assertTrue($block, 'Custom Block found in database.');
 
@@ -73,7 +74,7 @@ class BlockContentCreationTest extends BlockContentTestBase {
 
     // Check that the Basic block has been created.
     $this->assertRaw(format_string('A custom block with block description %value already exists.', [
-      '%value' => $edit['info[0][value]']
+      '%value' => $edit['info[0][value]'],
     ]));
     $this->assertResponse(200);
   }
@@ -103,7 +104,7 @@ class BlockContentCreationTest extends BlockContentTestBase {
     // Check that the Basic block has been created.
     $this->assertRaw(format_string('@block %name has been created.', [
       '@block' => 'basic',
-      '%name' => $edit['info[0][value]']
+      '%name' => $edit['info[0][value]'],
     ]), 'Basic block created.');
 
     // Save our block permanently
@@ -143,7 +144,9 @@ class BlockContentCreationTest extends BlockContentTestBase {
     $this->assertFieldByXPath('//select[@name="settings[view_mode]"]/option[@selected="selected"]', 'test_view_mode', 'View mode changed to Test View Mode');
 
     // Check that the block exists in the database.
-    $blocks = entity_load_multiple_by_properties('block_content', ['info' => $edit['info[0][value]']]);
+    $blocks = \Drupal::entityTypeManager()
+      ->getStorage('block_content')
+      ->loadByProperties(['info' => $edit['info[0][value]']]);
     $block = reset($blocks);
     $this->assertTrue($block, 'Custom Block found in database.');
 
@@ -153,7 +156,7 @@ class BlockContentCreationTest extends BlockContentTestBase {
 
     // Check that the Basic block has been created.
     $this->assertRaw(format_string('A custom block with block description %value already exists.', [
-      '%value' => $edit['info[0][value]']
+      '%value' => $edit['info[0][value]'],
     ]));
     $this->assertResponse(200);
   }
@@ -178,7 +181,9 @@ class BlockContentCreationTest extends BlockContentTestBase {
     ]), 'Basic block created.');
 
     // Check that the block exists in the database.
-    $blocks = entity_load_multiple_by_properties('block_content', ['info' => $edit['info[0][value]']]);
+    $blocks = \Drupal::entityTypeManager()
+      ->getStorage('block_content')
+      ->loadByProperties(['info' => $edit['info[0][value]']]);
     $block = reset($blocks);
     $this->assertTrue($block, 'Default Custom Block found in database.');
   }
@@ -233,7 +238,7 @@ class BlockContentCreationTest extends BlockContentTestBase {
 
     // Place the block.
     $instance = [
-      'id' => Unicode::strtolower($edit['info[0][value]']),
+      'id' => mb_strtolower($edit['info[0][value]']),
       'settings[label]' => $edit['info[0][value]'],
       'region' => 'sidebar_first',
     ];
@@ -285,7 +290,7 @@ class BlockContentCreationTest extends BlockContentTestBase {
   public function testConfigDependencies() {
     $block = $this->createBlockContent();
     // Place the block.
-    $block_placement_id = Unicode::strtolower($block->label());
+    $block_placement_id = mb_strtolower($block->label());
     $instance = [
       'id' => $block_placement_id,
       'settings[label]' => $block->label(),