Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php namespace Drupal\config\Tests; use Drupal\Core\Config\Entity\ConfigEntityInterface..
Decoded Output download
<?php
namespace Drupal\config\Tests;
use Drupal\Core\Config\Entity\ConfigEntityInterface;
/**
* Provides test assertions for testing config entity synchronization.
*
* Can be used by test classes that extend \Drupal\simpletest\WebTestBase or
* \Drupal\KernelTests\KernelTestBase.
*/
trait AssertConfigEntityImportTrait {
/**
* Asserts that a config entity can be imported without changing it.
*
* @param \Drupal\Core\Config\Entity\ConfigEntityInterface $entity
* The config entity to test importing.
*/
public function assertConfigEntityImport(ConfigEntityInterface $entity) {
// Save original config information.
$entity_uuid = $entity->uuid();
$entity_type_id = $entity->getEntityTypeId();
$original_data = $entity->toArray();
// Copy everything to sync.
$this->copyConfig(\Drupal::service('config.storage'), \Drupal::service('config.storage.sync'));
// Delete the configuration from active. Don't worry about side effects of
// deleting config like fields cleaning up field storages. The coming import
// should recreate everything as necessary.
$entity->delete();
$this->configImporter()->reset()->import();
$imported_entity = \Drupal::entityManager()->loadEntityByUuid($entity_type_id, $entity_uuid);
$this->assertIdentical($original_data, $imported_entity->toArray());
}
}
?>
Did this file decode correctly?
Original Code
<?php
namespace Drupal\config\Tests;
use Drupal\Core\Config\Entity\ConfigEntityInterface;
/**
* Provides test assertions for testing config entity synchronization.
*
* Can be used by test classes that extend \Drupal\simpletest\WebTestBase or
* \Drupal\KernelTests\KernelTestBase.
*/
trait AssertConfigEntityImportTrait {
/**
* Asserts that a config entity can be imported without changing it.
*
* @param \Drupal\Core\Config\Entity\ConfigEntityInterface $entity
* The config entity to test importing.
*/
public function assertConfigEntityImport(ConfigEntityInterface $entity) {
// Save original config information.
$entity_uuid = $entity->uuid();
$entity_type_id = $entity->getEntityTypeId();
$original_data = $entity->toArray();
// Copy everything to sync.
$this->copyConfig(\Drupal::service('config.storage'), \Drupal::service('config.storage.sync'));
// Delete the configuration from active. Don't worry about side effects of
// deleting config like fields cleaning up field storages. The coming import
// should recreate everything as necessary.
$entity->delete();
$this->configImporter()->reset()->import();
$imported_entity = \Drupal::entityManager()->loadEntityByUuid($entity_type_id, $entity_uuid);
$this->assertIdentical($original_data, $imported_entity->toArray());
}
}
Function Calls
None |
Stats
MD5 | 60b2b288fc015d7d1ddf3e6b93ce2cbf |
Eval Count | 0 |
Decode Time | 78 ms |