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\Tests\field\Kernel; use Drupal\field\Entity\FieldConfig; /** * ..

Decoded Output download

<?php

namespace Drupal\Testsield\Kernel;

use Drupalield\Entity\FieldConfig;

/**
 * Update field storage and fields during config change method invocation.
 *
 * @group field
 */
class FieldImportChangeTest extends FieldKernelTestBase {

  /**
   * Modules to enable.
   *
   * The default configuration provided by field_test_config is imported by
   * \Drupal\Testsield\Kernel\FieldKernelTestBase::setUp() when it installs
   * field configuration.
   *
   * @var array
   */
  public static $modules = ['field_test_config'];

  /**
   * Tests importing an updated field.
   */
  public function testImportChange() {
    $this->installConfig(['field_test_config']);
    $field_storage_id = 'field_test_import';
    $field_id = "entity_test.entity_test.$field_storage_id";
    $field_config_name = "field.field.$field_id";

    $active = $this->container->get('config.storage');
    $sync = $this->container->get('config.storage.sync');
    $this->copyConfig($active, $sync);

    // Save as files in the sync directory.
    $field = $active->read($field_config_name);
    $new_label = 'Test update import field';
    $field['label'] = $new_label;
    $sync->write($field_config_name, $field);

    // Import the content of the sync directory.
    $this->configImporter()->import();

    // Check that the updated config was correctly imported.
    $field = FieldConfig::load($field_id);
    $this->assertEqual($field->getLabel(), $new_label, 'field label updated');
  }

}
 ?>

Did this file decode correctly?

Original Code

<?php

namespace Drupal\Tests\field\Kernel;

use Drupal\field\Entity\FieldConfig;

/**
 * Update field storage and fields during config change method invocation.
 *
 * @group field
 */
class FieldImportChangeTest extends FieldKernelTestBase {

  /**
   * Modules to enable.
   *
   * The default configuration provided by field_test_config is imported by
   * \Drupal\Tests\field\Kernel\FieldKernelTestBase::setUp() when it installs
   * field configuration.
   *
   * @var array
   */
  public static $modules = ['field_test_config'];

  /**
   * Tests importing an updated field.
   */
  public function testImportChange() {
    $this->installConfig(['field_test_config']);
    $field_storage_id = 'field_test_import';
    $field_id = "entity_test.entity_test.$field_storage_id";
    $field_config_name = "field.field.$field_id";

    $active = $this->container->get('config.storage');
    $sync = $this->container->get('config.storage.sync');
    $this->copyConfig($active, $sync);

    // Save as files in the sync directory.
    $field = $active->read($field_config_name);
    $new_label = 'Test update import field';
    $field['label'] = $new_label;
    $sync->write($field_config_name, $field);

    // Import the content of the sync directory.
    $this->configImporter()->import();

    // Check that the updated config was correctly imported.
    $field = FieldConfig::load($field_id);
    $this->assertEqual($field->getLabel(), $new_label, 'field label updated');
  }

}

Function Calls

None

Variables

None

Stats

MD5 ed815361092464a17a366d6db1fece85
Eval Count 0
Decode Time 78 ms