Update to Drupal 8.0.3. For more information, see https://www.drupal.org/drupal-8.0.3-release-notes
This commit is contained in:
parent
10f9f7fbde
commit
9db4fae9a7
202 changed files with 3806 additions and 760 deletions
|
@ -33,7 +33,6 @@ class ConfigEventsTest extends KernelTestBase {
|
|||
|
||||
$config = new Config($name, \Drupal::service('config.storage'), \Drupal::service('event_dispatcher'), \Drupal::service('config.typed'));
|
||||
$config->set('key', 'initial');
|
||||
\Drupal::state()->get('config_events_test.event', FALSE);
|
||||
$this->assertIdentical(\Drupal::state()->get('config_events_test.event', array()), array(), 'No events fired by creating a new configuration object');
|
||||
$config->save();
|
||||
|
||||
|
|
|
@ -506,4 +506,70 @@ class ConfigSchemaTest extends KernelTestBase {
|
|||
$this->assertEqual($definitions['config_schema_test.hook']['additional_metadata'], 'new schema info');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests saving config when the type is wrapped by a dynamic type.
|
||||
*/
|
||||
public function testConfigSaveWithWrappingSchema() {
|
||||
$untyped_values = [
|
||||
'tests' => [
|
||||
[
|
||||
'wrapper_value' => 'foo',
|
||||
'plugin_id' => 'wrapper:foo',
|
||||
'internal_value' => 100,
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
$typed_values = [
|
||||
'tests' => [
|
||||
[
|
||||
'wrapper_value' => 'foo',
|
||||
'plugin_id' => 'wrapper:foo',
|
||||
'internal_value' => '100',
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
// Save config which has a schema that enforces types.
|
||||
\Drupal::configFactory()->getEditable('wrapping.config_schema_test.plugin_types')
|
||||
->setData($untyped_values)
|
||||
->save();
|
||||
$this->assertIdentical(\Drupal::config('wrapping.config_schema_test.plugin_types')
|
||||
->get(), $typed_values);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests dynamic config schema type with multiple sub-key references.
|
||||
*/
|
||||
public function testConfigSaveWithWrappingSchemaDoubleBrackets() {
|
||||
$untyped_values = [
|
||||
'tests' => [
|
||||
[
|
||||
'wrapper_value' => 'foo',
|
||||
'foo' => 'cat',
|
||||
'bar' => 'dog',
|
||||
'another_key' => 100,
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
$typed_values = [
|
||||
'tests' => [
|
||||
[
|
||||
'wrapper_value' => 'foo',
|
||||
'foo' => 'cat',
|
||||
'bar' => 'dog',
|
||||
'another_key' => '100',
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
// Save config which has a schema that enforces types.
|
||||
\Drupal::configFactory()->getEditable('wrapping.config_schema_test.double_brackets')
|
||||
->setData($untyped_values)
|
||||
->save();
|
||||
$this->assertIdentical(\Drupal::config('wrapping.config_schema_test.double_brackets')
|
||||
->get(), $typed_values);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ namespace Drupal\config\Tests\Storage;
|
|||
|
||||
use Drupal\Component\Serialization\Yaml;
|
||||
use Drupal\Core\Config\FileStorage;
|
||||
use Drupal\Core\Config\UnsupportedDataTypeConfigException;
|
||||
|
||||
/**
|
||||
* Tests FileStorage operations.
|
||||
|
@ -76,4 +77,19 @@ class FileStorageTest extends ConfigStorageTestBase {
|
|||
$this->assertIdentical($config_files, $expected_files, 'Absolute path, two config files found.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test UnsupportedDataTypeConfigException displays path of
|
||||
* erroneous file during read.
|
||||
*/
|
||||
public function testReadUnsupportedDataTypeConfigException() {
|
||||
file_put_contents($this->storage->getFilePath('core.extension'), PHP_EOL . 'foo : [bar}', FILE_APPEND);
|
||||
try {
|
||||
$config_parsed = $this->storage->read('core.extension');
|
||||
}
|
||||
catch (UnsupportedDataTypeConfigException $e) {
|
||||
$this->pass('Exception thrown when trying to read a field containing invalid data type.');
|
||||
$this->assertTrue((strpos($e->getMessage(), $this->storage->getFilePath('core.extension')) !== FALSE), 'Erroneous file path is displayed.');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -32,10 +32,10 @@ class EventSubscriber implements EventSubscriberInterface {
|
|||
}
|
||||
|
||||
/**
|
||||
* Reacts to the ConfigEvents::COLLECTION_NAMES event.
|
||||
* Reacts to the ConfigEvents::COLLECTION_INFO event.
|
||||
*
|
||||
* @param \Drupal\Core\Config\ConfigCollectionInfo $collection_info
|
||||
* The configuration collection names event.
|
||||
* The configuration collection info event.
|
||||
*/
|
||||
public function addCollections(ConfigCollectionInfo $collection_info) {
|
||||
$collections = $this->state->get('config_collection_install_test.collection_names', array());
|
||||
|
|
|
@ -213,3 +213,50 @@ config_test.dynamic.*.third_party.config_schema_test:
|
|||
type: integer
|
||||
string:
|
||||
type: string
|
||||
|
||||
wrapping.config_schema_test.plugin_types:
|
||||
type: config_object
|
||||
mapping:
|
||||
tests:
|
||||
type: sequence
|
||||
sequence:
|
||||
- type: wrapping.test.plugin_types.[plugin_id]
|
||||
|
||||
wrapping.test.plugin_types.*:
|
||||
type: test.plugin_types.[plugin_id]
|
||||
mapping:
|
||||
wrapper_value:
|
||||
type: string
|
||||
|
||||
test.plugin_types.wrapper:*:
|
||||
type: test.plugin_types
|
||||
mapping:
|
||||
internal_value:
|
||||
type: string
|
||||
|
||||
wrapping.config_schema_test.double_brackets:
|
||||
type: config_object
|
||||
mapping:
|
||||
tests:
|
||||
type: sequence
|
||||
sequence:
|
||||
- type: wrapping.test.double_brackets.[another_key]
|
||||
|
||||
wrapping.test.double_brackets.*:
|
||||
type: test.double_brackets.[foo].[bar]
|
||||
mapping:
|
||||
wrapper_value:
|
||||
type: string
|
||||
|
||||
test.double_brackets.cat.dog:
|
||||
type: test.double_brackets
|
||||
mapping:
|
||||
another_key:
|
||||
type: string
|
||||
foo:
|
||||
type: string
|
||||
bar:
|
||||
type: string
|
||||
|
||||
test.double_brackets.*:
|
||||
type: mapping
|
||||
|
|
Reference in a new issue