updated core to 8.6.1 via composer
This commit is contained in:
+1
-1
@@ -6,4 +6,4 @@ package: Testing
|
||||
version: VERSION
|
||||
core: 8.x
|
||||
dependencies:
|
||||
- config_collection_install_test
|
||||
- drupal:config_collection_install_test
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
collection: another_collection
|
||||
collection: another_collection
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
collection: collection.test1
|
||||
collection: collection.test1
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
collection: collection.test2
|
||||
collection: collection.test2
|
||||
|
||||
@@ -18,7 +18,7 @@ class ConfigOverrider implements ConfigFactoryOverrideInterface {
|
||||
return [
|
||||
'config_test.dynamic.test_1' => [
|
||||
'label' => 'Overridden label',
|
||||
]
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ class EventSubscriber implements EventSubscriberInterface {
|
||||
'event_name' => $name,
|
||||
'current_config_data' => $config->get(),
|
||||
'original_config_data' => $config->getOriginal(),
|
||||
'raw_config_data' => $config->getRawData()
|
||||
'raw_config_data' => $config->getRawData(),
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
* Provides configuration import test helpers.
|
||||
*/
|
||||
|
||||
use Drupal\Core\Config\ConfigImporter;
|
||||
|
||||
/**
|
||||
* Implements hook_config_import_steps_alter().
|
||||
*/
|
||||
@@ -17,9 +19,15 @@ function config_import_test_config_import_steps_alter(&$sync_steps) {
|
||||
*
|
||||
* @param array $context
|
||||
* The batch context.
|
||||
* @param \Drupal\Core\Config\ConfigImporter $config_importer
|
||||
* The configuration importer.
|
||||
*/
|
||||
function _config_import_test_config_import_steps_alter(&$context) {
|
||||
function _config_import_test_config_import_steps_alter(&$context, ConfigImporter $config_importer) {
|
||||
$GLOBALS['hook_config_test']['config_import_steps_alter'] = TRUE;
|
||||
if (\Drupal::state()->get('config_import_steps_alter.error', FALSE)) {
|
||||
$context['results']['errors'][] = '_config_import_test_config_import_steps_alter batch error';
|
||||
$config_importer->logError('_config_import_test_config_import_steps_alter ConfigImporter error');
|
||||
}
|
||||
$context['finished'] = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
id: dependency_for_unmet2
|
||||
label: 'Other module test to test optional config installation'
|
||||
weight: 0
|
||||
style: ''
|
||||
status: true
|
||||
langcode: en
|
||||
protected_property: Default
|
||||
+1
-1
@@ -4,4 +4,4 @@ package: Testing
|
||||
version: VERSION
|
||||
core: 8.x
|
||||
dependencies:
|
||||
- config_test
|
||||
- drupal:config_test
|
||||
|
||||
@@ -4,4 +4,4 @@ package: 'Testing'
|
||||
version: VERSION
|
||||
core: 8.x
|
||||
dependencies:
|
||||
- config_test
|
||||
- drupal:config_test
|
||||
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
id: other_module_test_optional_entity_unmet2
|
||||
label: 'Other module test to test optional config installation'
|
||||
weight: 0
|
||||
style: ''
|
||||
status: true
|
||||
langcode: en
|
||||
protected_property: Default
|
||||
dependencies:
|
||||
enforced:
|
||||
config:
|
||||
- config_test.dynamic.dependency_for_unmet2
|
||||
+2
-2
@@ -5,5 +5,5 @@ version: VERSION
|
||||
core: 8.x
|
||||
|
||||
dependencies:
|
||||
- block
|
||||
- block_test
|
||||
- drupal:block
|
||||
- drupal:block_test
|
||||
|
||||
@@ -5,5 +5,5 @@ version: VERSION
|
||||
core: 8.x
|
||||
|
||||
dependencies:
|
||||
- block
|
||||
- block_content
|
||||
- drupal:block
|
||||
- drupal:block_content
|
||||
|
||||
-13
@@ -61,17 +61,4 @@ class PirateDayCacheabilityMetadataConfigOverride implements ConfigFactoryOverri
|
||||
return $metadata;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether or not our overrides are potentially applicable.
|
||||
*
|
||||
* @param string $name
|
||||
* The name of the config object that is being constructed.
|
||||
*
|
||||
* @return bool
|
||||
* TRUE if the merchant ship will be boarded. FALSE if we drink rum instead.
|
||||
*/
|
||||
protected function isCacheabilityMetadataApplicable($name) {
|
||||
return in_array($name, ['system.theme', 'block.block.call_to_action']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -158,6 +158,14 @@ config_test.foo:
|
||||
config_test.bar:
|
||||
type: config_test.foo
|
||||
|
||||
system.action.*.third_party.config_test:
|
||||
type: mapping
|
||||
label: 'Third party setting for action entity'
|
||||
mapping:
|
||||
integer:
|
||||
type: integer
|
||||
label: 'Integer'
|
||||
|
||||
config_test.validation:
|
||||
type: config_object
|
||||
label: 'Configuration type'
|
||||
|
||||
@@ -138,10 +138,10 @@ class ConfigTestForm extends EntityForm {
|
||||
$status = $entity->save();
|
||||
|
||||
if ($status === SAVED_UPDATED) {
|
||||
drupal_set_message(format_string('%label configuration has been updated.', ['%label' => $entity->label()]));
|
||||
$this->messenger()->addStatus(format_string('%label configuration has been updated.', ['%label' => $entity->label()]));
|
||||
}
|
||||
else {
|
||||
drupal_set_message(format_string('%label configuration has been created.', ['%label' => $entity->label()]));
|
||||
$this->messenger()->addStatus(format_string('%label configuration has been created.', ['%label' => $entity->label()]));
|
||||
}
|
||||
|
||||
$form_state->setRedirectUrl($this->entity->urlInfo('collection'));
|
||||
|
||||
@@ -74,8 +74,11 @@ class ConfigValidation {
|
||||
* The validation execution context.
|
||||
*/
|
||||
public static function validateMapping($mapping, ExecutionContextInterface $context) {
|
||||
if ($diff = array_diff(array_keys($mapping), ['llama', 'cat', 'giraffe', 'uuid', '_core'])) {
|
||||
$context->addViolation('Missing giraffe.');
|
||||
// Ensure we are validating the entire mapping by diffing against all the
|
||||
// keys.
|
||||
$mapping_schema = \Drupal::service('config.typed')->get('config_test.validation')->getValue();
|
||||
if ($diff = array_diff_key($mapping, $mapping_schema)) {
|
||||
$context->addViolation('Unexpected keys: ' . implode(', ', array_keys($diff)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -113,6 +113,17 @@ class ConfigTest extends ConfigEntityBase implements ConfigTestInterface {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function calculateDependencies() {
|
||||
parent::calculateDependencies();
|
||||
if ($module = \Drupal::state()->get('config_test_new_dependency', FALSE)) {
|
||||
$this->addDependency('module', $module);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\Tests\config_test\Functional\Hal;
|
||||
|
||||
use Drupal\Tests\config_test\Functional\Rest\ConfigTestResourceTestBase;
|
||||
use Drupal\Tests\rest\Functional\AnonResourceTestTrait;
|
||||
|
||||
/**
|
||||
* @group hal
|
||||
*/
|
||||
class ConfigTestHalJsonAnonTest extends ConfigTestResourceTestBase {
|
||||
|
||||
use AnonResourceTestTrait;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = ['hal'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected static $format = 'hal_json';
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected static $mimeType = 'application/hal+json';
|
||||
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\Tests\config_test\Functional\Hal;
|
||||
|
||||
use Drupal\Tests\config_test\Functional\Rest\ConfigTestResourceTestBase;
|
||||
use Drupal\Tests\rest\Functional\BasicAuthResourceTestTrait;
|
||||
|
||||
/**
|
||||
* @group hal
|
||||
*/
|
||||
class ConfigTestHalJsonBasicAuthTest extends ConfigTestResourceTestBase {
|
||||
|
||||
use BasicAuthResourceTestTrait;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = ['hal', 'basic_auth'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected static $format = 'hal_json';
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected static $mimeType = 'application/hal+json';
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected static $auth = 'basic_auth';
|
||||
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\Tests\config_test\Functional\Hal;
|
||||
|
||||
use Drupal\Tests\config_test\Functional\Rest\ConfigTestResourceTestBase;
|
||||
use Drupal\Tests\rest\Functional\CookieResourceTestTrait;
|
||||
|
||||
/**
|
||||
* @group hal
|
||||
*/
|
||||
class ConfigTestHalJsonCookieTest extends ConfigTestResourceTestBase {
|
||||
|
||||
use CookieResourceTestTrait;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = ['hal'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected static $format = 'hal_json';
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected static $mimeType = 'application/hal+json';
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected static $auth = 'cookie';
|
||||
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\Tests\config_test\Functional\Rest;
|
||||
|
||||
use Drupal\Tests\rest\Functional\AnonResourceTestTrait;
|
||||
|
||||
/**
|
||||
* @group rest
|
||||
*/
|
||||
class ConfigTestJsonAnonTest extends ConfigTestResourceTestBase {
|
||||
|
||||
use AnonResourceTestTrait;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected static $format = 'json';
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected static $mimeType = 'application/json';
|
||||
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\Tests\config_test\Functional\Rest;
|
||||
|
||||
use Drupal\Tests\rest\Functional\BasicAuthResourceTestTrait;
|
||||
|
||||
/**
|
||||
* @group rest
|
||||
*/
|
||||
class ConfigTestJsonBasicAuthTest extends ConfigTestResourceTestBase {
|
||||
|
||||
use BasicAuthResourceTestTrait;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = ['basic_auth'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected static $format = 'json';
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected static $mimeType = 'application/json';
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected static $auth = 'basic_auth';
|
||||
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\Tests\config_test\Functional\Rest;
|
||||
|
||||
use Drupal\Tests\rest\Functional\CookieResourceTestTrait;
|
||||
|
||||
/**
|
||||
* @group rest
|
||||
*/
|
||||
class ConfigTestJsonCookieTest extends ConfigTestResourceTestBase {
|
||||
|
||||
use CookieResourceTestTrait;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected static $format = 'json';
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected static $mimeType = 'application/json';
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected static $auth = 'cookie';
|
||||
|
||||
}
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\Tests\config_test\Functional\Rest;
|
||||
|
||||
use Drupal\config_test\Entity\ConfigTest;
|
||||
use Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase;
|
||||
|
||||
abstract class ConfigTestResourceTestBase extends EntityResourceTestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = ['config_test', 'config_test_rest'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected static $entityTypeId = 'config_test';
|
||||
|
||||
/**
|
||||
* @var \Drupal\config_test\ConfigTestInterface
|
||||
*/
|
||||
protected $entity;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUpAuthorization($method) {
|
||||
$this->grantPermissionsToTestedRole(['view config_test']);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function createEntity() {
|
||||
$config_test = ConfigTest::create([
|
||||
'id' => 'llama',
|
||||
'label' => 'Llama',
|
||||
]);
|
||||
$config_test->save();
|
||||
|
||||
return $config_test;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function getExpectedNormalizedEntity() {
|
||||
$normalization = [
|
||||
'uuid' => $this->entity->uuid(),
|
||||
'id' => 'llama',
|
||||
'weight' => 0,
|
||||
'langcode' => 'en',
|
||||
'status' => TRUE,
|
||||
'dependencies' => [],
|
||||
'label' => 'Llama',
|
||||
'style' => NULL,
|
||||
'size' => NULL,
|
||||
'size_value' => NULL,
|
||||
'protected_property' => NULL,
|
||||
];
|
||||
|
||||
return $normalization;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function getNormalizedPostEntity() {
|
||||
// @todo Update in https://www.drupal.org/node/2300677.
|
||||
}
|
||||
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\Tests\config_test\Functional\Rest;
|
||||
|
||||
use Drupal\Tests\rest\Functional\AnonResourceTestTrait;
|
||||
use Drupal\Tests\rest\Functional\EntityResource\XmlEntityNormalizationQuirksTrait;
|
||||
|
||||
/**
|
||||
* @group rest
|
||||
*/
|
||||
class ConfigTestXmlAnonTest extends ConfigTestResourceTestBase {
|
||||
|
||||
use AnonResourceTestTrait;
|
||||
use XmlEntityNormalizationQuirksTrait;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected static $format = 'xml';
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected static $mimeType = 'text/xml; charset=UTF-8';
|
||||
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\Tests\config_test\Functional\Rest;
|
||||
|
||||
use Drupal\Tests\rest\Functional\BasicAuthResourceTestTrait;
|
||||
use Drupal\Tests\rest\Functional\EntityResource\XmlEntityNormalizationQuirksTrait;
|
||||
|
||||
/**
|
||||
* @group rest
|
||||
*/
|
||||
class ConfigTestXmlBasicAuthTest extends ConfigTestResourceTestBase {
|
||||
|
||||
use BasicAuthResourceTestTrait;
|
||||
use XmlEntityNormalizationQuirksTrait;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = ['basic_auth'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected static $format = 'xml';
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected static $mimeType = 'text/xml; charset=UTF-8';
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected static $auth = 'basic_auth';
|
||||
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\Tests\config_test\Functional\Rest;
|
||||
|
||||
use Drupal\Tests\rest\Functional\CookieResourceTestTrait;
|
||||
use Drupal\Tests\rest\Functional\EntityResource\XmlEntityNormalizationQuirksTrait;
|
||||
|
||||
/**
|
||||
* @group rest
|
||||
*/
|
||||
class ConfigTestXmlCookieTest extends ConfigTestResourceTestBase {
|
||||
|
||||
use CookieResourceTestTrait;
|
||||
use XmlEntityNormalizationQuirksTrait;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected static $format = 'xml';
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected static $mimeType = 'text/xml; charset=UTF-8';
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected static $auth = 'cookie';
|
||||
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
id: does_not_match
|
||||
label: Default
|
||||
weight: 0
|
||||
protected_property: Default
|
||||
langcode: en
|
||||
@@ -0,0 +1,7 @@
|
||||
name: 'Configuration test ID mismatch'
|
||||
type: module
|
||||
package: Testing
|
||||
version: VERSION
|
||||
core: 8.x
|
||||
dependencies:
|
||||
- drupal:config_test
|
||||
@@ -4,4 +4,4 @@ package: Testing
|
||||
version: VERSION
|
||||
core: 8.x
|
||||
dependencies:
|
||||
- config_test
|
||||
- drupal:config_test
|
||||
|
||||
@@ -243,7 +243,7 @@ class ConfigEntityListTest extends BrowserTestBase {
|
||||
$this->assertNoFieldByXpath('//td', 'dotted.default', "No machine name found for deleted 'Default' entity.");
|
||||
|
||||
// Confirm that the empty text is displayed.
|
||||
$this->assertText('There is no Test configuration yet.');
|
||||
$this->assertText('There are no test configuration entities yet.');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Drupal\Tests\config\Functional;
|
||||
|
||||
use Drupal\Component\Utility\SafeMarkup;
|
||||
use Drupal\Component\Render\FormattableMarkup;
|
||||
use Drupal\Core\Entity\EntityMalformedException;
|
||||
use Drupal\Core\Entity\EntityStorageException;
|
||||
use Drupal\Core\Config\Entity\ConfigEntityStorage;
|
||||
@@ -147,7 +147,7 @@ class ConfigEntityTest extends BrowserTestBase {
|
||||
]);
|
||||
try {
|
||||
$id_length_config_test->save();
|
||||
$this->pass(SafeMarkup::format("config_test entity with ID length @length was saved.", [
|
||||
$this->pass(new FormattableMarkup("config_test entity with ID length @length was saved.", [
|
||||
'@length' => strlen($id_length_config_test->id()),
|
||||
]));
|
||||
}
|
||||
@@ -161,7 +161,7 @@ class ConfigEntityTest extends BrowserTestBase {
|
||||
]);
|
||||
try {
|
||||
$id_length_config_test->save();
|
||||
$this->pass(SafeMarkup::format("config_test entity with ID length @length was saved.", [
|
||||
$this->pass(new FormattableMarkup("config_test entity with ID length @length was saved.", [
|
||||
'@length' => strlen($id_length_config_test->id()),
|
||||
]));
|
||||
}
|
||||
@@ -175,13 +175,13 @@ class ConfigEntityTest extends BrowserTestBase {
|
||||
]);
|
||||
try {
|
||||
$status = $id_length_config_test->save();
|
||||
$this->fail(SafeMarkup::format("config_test entity with ID length @length exceeding the maximum allowed length of @max saved successfully", [
|
||||
$this->fail(new FormattableMarkup("config_test entity with ID length @length exceeding the maximum allowed length of @max saved successfully", [
|
||||
'@length' => strlen($id_length_config_test->id()),
|
||||
'@max' => static::MAX_ID_LENGTH,
|
||||
]));
|
||||
}
|
||||
catch (ConfigEntityIdLengthException $e) {
|
||||
$this->pass(SafeMarkup::format("config_test entity with ID length @length exceeding the maximum allowed length of @max failed to save", [
|
||||
$this->pass(new FormattableMarkup("config_test entity with ID length @length exceeding the maximum allowed length of @max failed to save", [
|
||||
'@length' => strlen($id_length_config_test->id()),
|
||||
'@max' => static::MAX_ID_LENGTH,
|
||||
]));
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace Drupal\Tests\config\Functional;
|
||||
|
||||
use Drupal\Component\Utility\Unicode;
|
||||
use Drupal\Core\Archiver\ArchiveTar;
|
||||
use Drupal\field\Entity\FieldConfig;
|
||||
use Drupal\field\Entity\FieldStorageConfig;
|
||||
@@ -102,7 +101,7 @@ class ConfigExportImportUITest extends BrowserTestBase {
|
||||
$this->contentType = $this->drupalCreateContentType();
|
||||
|
||||
// Create a field.
|
||||
$this->fieldName = Unicode::strtolower($this->randomMachineName());
|
||||
$this->fieldName = mb_strtolower($this->randomMachineName());
|
||||
$this->fieldStorage = FieldStorageConfig::create([
|
||||
'field_name' => $this->fieldName,
|
||||
'entity_type' => 'node',
|
||||
@@ -135,7 +134,7 @@ class ConfigExportImportUITest extends BrowserTestBase {
|
||||
|
||||
// Export the configuration.
|
||||
$this->drupalPostForm('admin/config/development/configuration/full/export', [], 'Export');
|
||||
$this->tarball = $this->getRawContent();
|
||||
$this->tarball = $this->getSession()->getPage()->getContent();
|
||||
|
||||
$this->config('system.site')
|
||||
->set('slogan', $this->originalSlogan)
|
||||
@@ -225,7 +224,7 @@ class ConfigExportImportUITest extends BrowserTestBase {
|
||||
|
||||
// Export the configuration.
|
||||
$this->drupalPostForm('admin/config/development/configuration/full/export', [], 'Export');
|
||||
$this->tarball = $this->getRawContent();
|
||||
$this->tarball = $this->getSession()->getPage()->getContent();
|
||||
$filename = file_directory_temp() . '/' . $this->randomMachineName();
|
||||
file_put_contents($filename, $this->tarball);
|
||||
|
||||
|
||||
@@ -3,9 +3,7 @@
|
||||
namespace Drupal\Tests\config\Functional;
|
||||
|
||||
use Drupal\Core\Config\StorageComparer;
|
||||
use Drupal\filter\Entity\FilterFormat;
|
||||
use Drupal\shortcut\Entity\Shortcut;
|
||||
use Drupal\taxonomy\Entity\Term;
|
||||
use Drupal\Core\Entity\ContentEntityTypeInterface;
|
||||
use Drupal\Tests\SchemaCheckTestTrait;
|
||||
use Drupal\Tests\system\Functional\Module\ModuleTestBase;
|
||||
|
||||
@@ -72,33 +70,29 @@ class ConfigImportAllTest extends ModuleTestBase {
|
||||
system_list_reset();
|
||||
$this->resetAll();
|
||||
|
||||
// Delete every field on the site so all modules can be uninstalled. For
|
||||
// example, if a comment field exists then module becomes required and can
|
||||
// not be uninstalled.
|
||||
// Delete all entities provided by modules that prevent uninstallation. For
|
||||
// example, if any content entity exists its provider cannot be uninstalled.
|
||||
// So deleting all taxonomy terms allows the Taxonomy to be uninstalled.
|
||||
// Additionally, every field is deleted so modules can be uninstalled. For
|
||||
// example, if a comment field exists then Comment cannot be uninstalled.
|
||||
$entity_type_manager = \Drupal::entityTypeManager();
|
||||
foreach ($entity_type_manager->getDefinitions() as $entity_type) {
|
||||
if (($entity_type instanceof ContentEntityTypeInterface || in_array($entity_type->id(), ['field_storage_config', 'filter_format'], TRUE))
|
||||
&& !in_array($entity_type->getProvider(), ['system', 'user'], TRUE)) {
|
||||
$storage = $entity_type_manager->getStorage($entity_type->id());
|
||||
$storage->delete($storage->loadMultiple());
|
||||
}
|
||||
}
|
||||
|
||||
$field_storages = \Drupal::entityManager()->getStorage('field_storage_config')->loadMultiple();
|
||||
\Drupal::entityManager()->getStorage('field_storage_config')->delete($field_storages);
|
||||
// Purge the data.
|
||||
// Purge the field data.
|
||||
field_purge_batch(1000);
|
||||
|
||||
// Delete all terms.
|
||||
$terms = Term::loadMultiple();
|
||||
entity_delete_multiple('taxonomy_term', array_keys($terms));
|
||||
|
||||
// Delete all filter formats.
|
||||
$filters = FilterFormat::loadMultiple();
|
||||
entity_delete_multiple('filter_format', array_keys($filters));
|
||||
|
||||
// Delete any shortcuts so the shortcut module can be uninstalled.
|
||||
$shortcuts = Shortcut::loadMultiple();
|
||||
entity_delete_multiple('shortcut', array_keys($shortcuts));
|
||||
|
||||
system_list_reset();
|
||||
$all_modules = system_rebuild_module_data();
|
||||
|
||||
// Ensure that only core required modules and the install profile can not be uninstalled.
|
||||
$validation_reasons = \Drupal::service('module_installer')->validateUninstall(array_keys($all_modules));
|
||||
$this->assertEqual(['standard', 'system', 'user'], array_keys($validation_reasons));
|
||||
$this->assertEqual(['system', 'user', 'standard'], array_keys($validation_reasons));
|
||||
|
||||
$modules_to_uninstall = array_filter($all_modules, function ($module) use ($validation_reasons) {
|
||||
// Filter required and not enabled modules.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
namespace Drupal\Tests\config\Functional;
|
||||
|
||||
use Drupal\Component\Utility\Html;
|
||||
use Drupal\Component\Utility\SafeMarkup;
|
||||
use Drupal\Component\Render\FormattableMarkup;
|
||||
use Drupal\Core\Config\InstallStorage;
|
||||
use Drupal\Tests\BrowserTestBase;
|
||||
|
||||
@@ -433,7 +433,7 @@ class ConfigImportUITest extends BrowserTestBase {
|
||||
|
||||
// Attempt to import configuration and verify that an error message appears.
|
||||
$this->drupalPostForm(NULL, [], t('Import all'));
|
||||
$this->assertText(SafeMarkup::format('Deleted and replaced configuration entity "@name"', ['@name' => $name_secondary]));
|
||||
$this->assertText(new FormattableMarkup('Deleted and replaced configuration entity "@name"', ['@name' => $name_secondary]));
|
||||
$this->assertText(t('The configuration was imported with errors.'));
|
||||
$this->assertNoText(t('The configuration was imported successfully.'));
|
||||
$this->assertText(t('There are no configuration changes to import.'));
|
||||
@@ -518,4 +518,17 @@ class ConfigImportUITest extends BrowserTestBase {
|
||||
$this->assertText('Unable to install the does_not_exist theme since it does not exist.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that errors set in the batch and on the ConfigImporter are merged.
|
||||
*/
|
||||
public function testBatchErrors() {
|
||||
$new_site_name = 'Config import test ' . $this->randomString();
|
||||
$this->prepareSiteNameUpdate($new_site_name);
|
||||
\Drupal::state()->set('config_import_steps_alter.error', TRUE);
|
||||
$this->drupalPostForm('admin/config/development/configuration', [], t('Import all'));
|
||||
$this->assertSession()->responseContains('_config_import_test_config_import_steps_alter batch error');
|
||||
$this->assertSession()->responseContains('_config_import_test_config_import_steps_alter ConfigImporter error');
|
||||
$this->assertSession()->responseContains('The configuration was imported with errors.');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@ class ConfigInstallProfileOverrideTest extends BrowserTestBase {
|
||||
*/
|
||||
protected $profile = 'testing_config_overrides';
|
||||
|
||||
|
||||
/**
|
||||
* Tests install profile config changes.
|
||||
*/
|
||||
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\Tests\config\Functional;
|
||||
|
||||
use Drupal\FunctionalTests\Installer\InstallerTestBase;
|
||||
use Drupal\Core\Config\InstallStorage;
|
||||
use Drupal\Core\Serialization\Yaml;
|
||||
|
||||
/**
|
||||
* Tests install profile config overrides can not add unmet dependencies.
|
||||
*
|
||||
* @group Config
|
||||
*/
|
||||
class ConfigInstallProfileUnmetDependenciesTest extends InstallerTestBase {
|
||||
|
||||
/**
|
||||
* The installation profile to install.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $profile = 'testing_config_overrides';
|
||||
|
||||
/**
|
||||
* Contains the expected exception if it is thrown.
|
||||
*
|
||||
* @var \Drupal\Core\Config\UnmetDependenciesException
|
||||
*/
|
||||
protected $expectedException = FALSE;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function prepareEnvironment() {
|
||||
parent::prepareEnvironment();
|
||||
$this->copyTestingOverrides();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
// During set up an UnmetDependenciesException should be thrown, which will
|
||||
// be re-thrown by TestHttpClientMiddleware as a standard Exception.
|
||||
try {
|
||||
parent::setUp();
|
||||
}
|
||||
catch (\Exception $exception) {
|
||||
$this->expectedException = $exception;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy the testing_config_overrides install profile.
|
||||
*
|
||||
* So we can change the configuration to include a dependency that can not be
|
||||
* met. File API functions are not available yet.
|
||||
*/
|
||||
protected function copyTestingOverrides() {
|
||||
$dest = $this->siteDirectory . '/profiles/testing_config_overrides';
|
||||
mkdir($dest, 0777, TRUE);
|
||||
$source = DRUPAL_ROOT . '/core/profiles/testing_config_overrides';
|
||||
$iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($source, \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::SELF_FIRST);
|
||||
foreach ($iterator as $item) {
|
||||
if ($item->isDir()) {
|
||||
mkdir($dest . DIRECTORY_SEPARATOR . $iterator->getSubPathName());
|
||||
}
|
||||
else {
|
||||
copy($item, $dest . DIRECTORY_SEPARATOR . $iterator->getSubPathName());
|
||||
}
|
||||
}
|
||||
|
||||
// Add a dependency that can not be met because User is installed before
|
||||
// Action.
|
||||
$config_file = $dest . DIRECTORY_SEPARATOR . InstallStorage::CONFIG_INSTALL_DIRECTORY . DIRECTORY_SEPARATOR . 'system.action.user_block_user_action.yml';
|
||||
$action = Yaml::decode(file_get_contents($config_file));
|
||||
$action['dependencies']['module'][] = 'action';
|
||||
file_put_contents($config_file, Yaml::encode($action));
|
||||
}
|
||||
|
||||
/**
|
||||
* Confirms that the installation succeeded.
|
||||
*/
|
||||
public function testInstalled() {
|
||||
if ($this->expectedException) {
|
||||
$this->assertContains('Configuration objects provided by <em class="placeholder">user</em> have unmet dependencies: <em class="placeholder">system.action.user_block_user_action (action)</em>', $this->expectedException->getMessage());
|
||||
$this->assertContains('Drupal\Core\Config\UnmetDependenciesException', $this->expectedException->getMessage());
|
||||
}
|
||||
else {
|
||||
$this->fail('Expected Drupal\Core\Config\UnmetDependenciesException exception not thrown');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -21,7 +21,7 @@ class ConfigLanguageOverrideWebTest extends BrowserTestBase {
|
||||
public static $modules = [
|
||||
'block',
|
||||
'language',
|
||||
'system'
|
||||
'system',
|
||||
];
|
||||
|
||||
/**
|
||||
|
||||
@@ -62,12 +62,29 @@ class ConfigOtherModuleTest extends BrowserTestBase {
|
||||
$this->assertNull(entity_load('config_test', 'other_module_test_unmet', TRUE), 'The optional configuration config_test.dynamic.other_module_test_unmet whose dependencies are not met is not created.');
|
||||
$this->assertNull(entity_load('config_test', 'other_module_test_optional_entity_unmet', TRUE), 'The optional configuration config_test.dynamic.other_module_test_optional_entity_unmet whose dependencies are not met is not created.');
|
||||
$this->installModule('config_test_language');
|
||||
$this->assertNull(entity_load('config_test', 'other_module_test_optional_entity_unmet2', TRUE), 'The optional configuration config_test.dynamic.other_module_test_optional_entity_unmet2 whose dependencies are not met is not created.');
|
||||
$this->installModule('config_install_dependency_test');
|
||||
$this->assertTrue(entity_load('config_test', 'other_module_test_unmet', TRUE), 'The optional configuration config_test.dynamic.other_module_test_unmet whose dependencies are met is now created.');
|
||||
// Although the following configuration entity's are now met it is not
|
||||
// installed because it does not have a direct dependency on the
|
||||
// config_install_dependency_test module.
|
||||
$this->assertNull(entity_load('config_test', 'other_module_test_optional_entity_unmet', TRUE), 'The optional configuration config_test.dynamic.other_module_test_optional_entity_unmet whose dependencies are met is not created.');
|
||||
// The following configuration entity's dependencies are now met. It is
|
||||
// indirectly dependent on the config_install_dependency_test module because
|
||||
// it has a dependency on the config_test.dynamic.dependency_for_unmet2
|
||||
// configuration provided by that module and, therefore, should be created.
|
||||
$this->assertTrue(entity_load('config_test', 'other_module_test_optional_entity_unmet2', TRUE), 'The optional configuration config_test.dynamic.other_module_test_optional_entity_unmet2 whose dependencies are met is now created.');
|
||||
|
||||
// The following configuration entity's dependencies are now met even though
|
||||
// it has no direct dependency on the module. It is indirectly dependent on
|
||||
// the config_install_dependency_test module because it has a dependency on
|
||||
// the config_test.dynamic.other_module_test_unmet configuration that is
|
||||
// dependent on the config_install_dependency_test module and, therefore,
|
||||
// should be created.
|
||||
$entity = entity_load('config_test', 'other_module_test_optional_entity_unmet', TRUE);
|
||||
$this->assertTrue($entity, 'The optional configuration config_test.dynamic.other_module_test_optional_entity_unmet whose dependencies are met is created.');
|
||||
$entity->delete();
|
||||
|
||||
// Install another module to ensure the configuration just deleted is not
|
||||
// recreated.
|
||||
$this->installModule('config');
|
||||
$this->assertFalse(entity_load('config_test', 'other_module_test_optional_entity_unmet', TRUE), 'The optional configuration config_test.dynamic.other_module_test_optional_entity_unmet whose dependencies are met is not installed when an unrelated module is installed.');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -177,7 +177,7 @@ EOD;
|
||||
// object.
|
||||
$this->assertRaw(t('Are you sure you want to update the %name @type?', [
|
||||
'%name' => 'second',
|
||||
'@type' => 'test configuration'
|
||||
'@type' => 'test configuration',
|
||||
]));
|
||||
$this->drupalPostForm(NULL, [], t('Confirm'));
|
||||
$entity = $storage->load('second');
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
|
||||
namespace Drupal\Tests\config\FunctionalJavascript;
|
||||
|
||||
use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
|
||||
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
|
||||
|
||||
/**
|
||||
* Tests the Config operations through the UI.
|
||||
*
|
||||
* @group config
|
||||
*/
|
||||
class ConfigEntityTest extends JavascriptTestBase {
|
||||
class ConfigEntityTest extends WebDriverTestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\Tests\config\Kernel;
|
||||
|
||||
use Drupal\Core\Config\ConfigImporter;
|
||||
use Drupal\Core\Config\StorageComparer;
|
||||
use Drupal\KernelTests\KernelTestBase;
|
||||
|
||||
/**
|
||||
* Tests importing configuration from files into active configuration.
|
||||
*
|
||||
* @group config
|
||||
*/
|
||||
class ConfigUninstallViaCliImportTest extends KernelTestBase {
|
||||
/**
|
||||
* Config Importer object used for testing.
|
||||
*
|
||||
* @var \Drupal\Core\Config\ConfigImporter
|
||||
*/
|
||||
protected $configImporter;
|
||||
|
||||
/**
|
||||
* Modules to enable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $modules = ['system', 'config'];
|
||||
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
if (PHP_SAPI !== 'cli') {
|
||||
$this->markTestSkipped('This test has to be run from the CLI');
|
||||
}
|
||||
|
||||
$this->installConfig(['system']);
|
||||
$this->copyConfig($this->container->get('config.storage'), $this->container->get('config.storage.sync'));
|
||||
|
||||
// Set up the ConfigImporter object for testing.
|
||||
$storage_comparer = new StorageComparer(
|
||||
$this->container->get('config.storage.sync'),
|
||||
$this->container->get('config.storage'),
|
||||
$this->container->get('config.manager')
|
||||
);
|
||||
$this->configImporter = new ConfigImporter(
|
||||
$storage_comparer->createChangelist(),
|
||||
$this->container->get('event_dispatcher'),
|
||||
$this->container->get('config.manager'),
|
||||
$this->container->get('lock'),
|
||||
$this->container->get('config.typed'),
|
||||
$this->container->get('module_handler'),
|
||||
$this->container->get('module_installer'),
|
||||
$this->container->get('theme_handler'),
|
||||
$this->container->get('string_translation')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that the config mopdule can be uninstalled via CLI config import.
|
||||
*
|
||||
* @see \Drupal\config\ConfigSubscriber
|
||||
*/
|
||||
public function testConfigUninstallViaCli() {
|
||||
$this->assertTrue($this->container->get('module_handler')->moduleExists('config'));
|
||||
$sync = $this->container->get('config.storage.sync');
|
||||
$extensions = $sync->read('core.extension');
|
||||
unset($extensions['module']['config']);
|
||||
$sync->write('core.extension', $extensions);
|
||||
$this->configImporter->reset()->import();
|
||||
$this->assertFalse($this->container->get('module_handler')->moduleExists('config'));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user