Commit 701c3a87 authored by LKS90's avatar LKS90

Replaced all occurrences of String class with SafeMarkup equivalent and...

Replaced all occurrences of String class with SafeMarkup equivalent and updated the usage declarations
parent 48ea1258
......@@ -7,7 +7,7 @@
namespace Drupal\default_content;
use Drupal\Component\Utility\String;
use Drupal\Component\Utility\SafeMarkup;
use Drupal\Core\Config\Entity\ConfigEntityInterface;
use Drupal\Core\Entity\ContentEntityInterface;
use Drupal\Core\Entity\EntityManager;
......@@ -124,7 +124,7 @@ class DefaultContentManager implements DefaultContentManagerInterface {
'@first' => $file_map[$self]->uri,
'@second' => $file->uri,
);
throw new \Exception(String::format('Default content with href @href exists twice: @first @second', $args));
throw new \Exception(SafeMarkup::format('Default content with href @href exists twice: @first @second', $args));
}
// Store the entity type with the file.
......@@ -187,7 +187,7 @@ class DefaultContentManager implements DefaultContentManagerInterface {
$entity = $storage->load($entity_id);
if (!$entity) {
throw new \InvalidArgumentException(String::format('Entity @type with ID @id does not exist', ['@type' => $entity_type_id, '@id' => $entity_id]));
throw new \InvalidArgumentException(SafeMarkup::format('Entity @type with ID @id does not exist', ['@type' => $entity_type_id, '@id' => $entity_id]));
}
/** @var \Drupal\Core\Entity\ContentEntityInterface[] $entities */
......
......@@ -37,7 +37,7 @@ class DefaultContentTest extends WebTestBase {
public function testImport() {
// Login as admin.
$this->drupalLogin($this->drupalCreateUser(array_keys(\Drupal::moduleHandler()->invokeAll(('permission')))));
// Enable the module and import the content.
// Enable the module and import the content. BREAKS ON THIS LINE
\Drupal::service('module_installer')->install(array('default_content_test'), TRUE);
$this->rebuildContainer();
$node = $this->drupalGetNodeByTitle('Imported node');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment