Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
drupal
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Custom Issue Tracker
Custom Issue Tracker
Labels
Merge Requests
299
Merge Requests
299
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
project
drupal
Commits
ae049e93
Commit
ae049e93
authored
Dec 11, 2014
by
catch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#2391021
by Gábor Hojtsy: Config schema issues in config tests themselves
parent
827b39b4
Changes
19
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
173 additions
and
9 deletions
+173
-9
core/lib/Drupal/Core/Config/Testing/ConfigSchemaChecker.php
core/lib/Drupal/Core/Config/Testing/ConfigSchemaChecker.php
+11
-1
core/modules/config/src/Tests/ConfigCRUDTest.php
core/modules/config/src/Tests/ConfigCRUDTest.php
+10
-1
core/modules/config/src/Tests/ConfigDependencyTest.php
core/modules/config/src/Tests/ConfigDependencyTest.php
+9
-0
core/modules/config/src/Tests/ConfigEntityNormalizeTest.php
core/modules/config/src/Tests/ConfigEntityNormalizeTest.php
+9
-0
core/modules/config/src/Tests/ConfigEventsTest.php
core/modules/config/src/Tests/ConfigEventsTest.php
+9
-0
core/modules/config/src/Tests/ConfigFileContentTest.php
core/modules/config/src/Tests/ConfigFileContentTest.php
+10
-0
core/modules/config/src/Tests/ConfigImportRenameValidationTest.php
...les/config/src/Tests/ConfigImportRenameValidationTest.php
+9
-0
core/modules/config/src/Tests/ConfigInstallTest.php
core/modules/config/src/Tests/ConfigInstallTest.php
+10
-0
core/modules/config/src/Tests/ConfigLanguageOverrideTest.php
core/modules/config/src/Tests/ConfigLanguageOverrideTest.php
+9
-0
core/modules/config/src/Tests/ConfigOverrideTest.php
core/modules/config/src/Tests/ConfigOverrideTest.php
+9
-0
core/modules/config/src/Tests/ConfigSchemaTest.php
core/modules/config/src/Tests/ConfigSchemaTest.php
+9
-0
core/modules/config/src/Tests/SchemaCheckTraitTest.php
core/modules/config/src/Tests/SchemaCheckTraitTest.php
+10
-0
core/modules/config/src/Tests/SchemaConfigListenerTest.php
core/modules/config/src/Tests/SchemaConfigListenerTest.php
+2
-2
core/modules/config/src/Tests/SchemaConfigListenerWebTest.php
.../modules/config/src/Tests/SchemaConfigListenerWebTest.php
+3
-3
core/modules/config/tests/config_collection_install_test/config/schema/config_collection_install_test.schema.yml
...t/config/schema/config_collection_install_test.schema.yml
+7
-0
core/modules/config/tests/config_events_test/config/schema/config_events_test.schema.yml
...g_events_test/config/schema/config_events_test.schema.yml
+7
-0
core/modules/config/tests/config_test/config/schema/config_test.schema.yml
...ig/tests/config_test/config/schema/config_test.schema.yml
+38
-0
core/modules/config/tests/config_test/src/Entity/ConfigQueryTest.php
...s/config/tests/config_test/src/Entity/ConfigQueryTest.php
+1
-1
core/modules/config/tests/config_test/src/SchemaListenerController.php
...config/tests/config_test/src/SchemaListenerController.php
+1
-1
No files found.
core/lib/Drupal/Core/Config/Testing/ConfigSchemaChecker.php
View file @
ae049e93
...
...
@@ -66,7 +66,17 @@ public function onConfigSave(ConfigCrudEvent $event) {
$name
=
$saved_config
->
getName
();
$data
=
$saved_config
->
get
();
$checksum
=
crc32
(
serialize
(
$data
));
if
(
!
isset
(
$this
->
checked
[
$name
.
':'
.
$checksum
]))
{
$exceptions
=
array
(
// Following are used to test lack of or partial schema. Where partial
// schema is provided, that is explicitly tested in specific tests.
'config_schema_test.noschema'
,
'config_schema_test.someschema'
,
'config_schema_test.schema_data_types'
,
'config_schema_test.no_schema_data_types'
,
// Used to test application of schema to filtering of configuration.
'config_test.dynamic.system'
,
);
if
(
!
in_array
(
$name
,
$exceptions
)
&&
!
isset
(
$this
->
checked
[
$name
.
':'
.
$checksum
]))
{
$this
->
checked
[
$name
.
':'
.
$checksum
]
=
TRUE
;
$errors
=
$this
->
checkConfigSchema
(
$this
->
typedManager
,
$name
,
$data
);
if
(
$errors
===
FALSE
)
{
...
...
core/modules/config/src/Tests/ConfigCRUDTest.php
View file @
ae049e93
...
...
@@ -23,6 +23,15 @@
*/
class
ConfigCRUDTest
extends
KernelTestBase
{
/**
* Exempt from strict schema checking.
*
* @see \Drupal\Core\Config\Testing\ConfigSchemaChecker
*
* @var bool
*/
protected
$strictConfigSchema
=
FALSE
;
/**
* Modules to enable.
*
...
...
@@ -178,7 +187,7 @@ function testNameValidation() {
$config
->
save
();
$this
->
pass
(
$message
);
}
catch
(
\
Exception
$e
)
{
catch
(
ConfigName
Exception
$e
)
{
$this
->
fail
(
$message
);
}
...
...
core/modules/config/src/Tests/ConfigDependencyTest.php
View file @
ae049e93
...
...
@@ -16,6 +16,15 @@
*/
class
ConfigDependencyTest
extends
KernelTestBase
{
/**
* Set to TRUE to strict check all configuration saved.
*
* @see \Drupal\Core\Config\Testing\ConfigSchemaChecker
*
* @var bool
*/
protected
$strictConfigSchema
=
TRUE
;
/**
* Modules to enable.
*
...
...
core/modules/config/src/Tests/ConfigEntityNormalizeTest.php
View file @
ae049e93
...
...
@@ -11,6 +11,15 @@
*/
class
ConfigEntityNormalizeTest
extends
KernelTestBase
{
/**
* Set to TRUE to strict check all configuration saved.
*
* @see \Drupal\Core\Config\Testing\ConfigSchemaChecker
*
* @var bool
*/
protected
$strictConfigSchema
=
TRUE
;
public
static
$modules
=
array
(
'config_test'
);
protected
function
setUp
()
{
...
...
core/modules/config/src/Tests/ConfigEventsTest.php
View file @
ae049e93
...
...
@@ -18,6 +18,15 @@
*/
class
ConfigEventsTest
extends
KernelTestBase
{
/**
* Set to TRUE to strict check all configuration saved.
*
* @see \Drupal\Core\Config\Testing\ConfigSchemaChecker
*
* @var bool
*/
protected
$strictConfigSchema
=
TRUE
;
/**
* Modules to enable.
*
...
...
core/modules/config/src/Tests/ConfigFileContentTest.php
View file @
ae049e93
...
...
@@ -16,6 +16,16 @@
* @group config
*/
class
ConfigFileContentTest
extends
KernelTestBase
{
/**
* Exempt from strict schema checking.
*
* @see \Drupal\Core\Config\Testing\ConfigSchemaChecker
*
* @var bool
*/
protected
$strictConfigSchema
=
FALSE
;
/**
* Tests setting, writing, and reading of a configuration setting.
*/
...
...
core/modules/config/src/Tests/ConfigImportRenameValidationTest.php
View file @
ae049e93
...
...
@@ -22,6 +22,15 @@
*/
class
ConfigImportRenameValidationTest
extends
KernelTestBase
{
/**
* Set to TRUE to strict check all configuration saved.
*
* @see \Drupal\Core\Config\Testing\ConfigSchemaChecker
*
* @var bool
*/
protected
$strictConfigSchema
=
TRUE
;
/**
* Config Importer object used for testing.
*
...
...
core/modules/config/src/Tests/ConfigInstallTest.php
View file @
ae049e93
...
...
@@ -16,6 +16,16 @@
* @see \Drupal\Core\Config\ConfigInstaller
*/
class
ConfigInstallTest
extends
KernelTestBase
{
/**
* Set to TRUE to strict check all configuration saved.
*
* @see \Drupal\Core\Config\Testing\ConfigSchemaChecker
*
* @var bool
*/
protected
$strictConfigSchema
=
TRUE
;
protected
function
setUp
()
{
parent
::
setUp
();
...
...
core/modules/config/src/Tests/ConfigLanguageOverrideTest.php
View file @
ae049e93
...
...
@@ -17,6 +17,15 @@
*/
class
ConfigLanguageOverrideTest
extends
KernelTestBase
{
/**
* Set to TRUE to strict check all configuration saved.
*
* @see \Drupal\Core\Config\Testing\ConfigSchemaChecker
*
* @var bool
*/
protected
$strictConfigSchema
=
TRUE
;
/**
* Modules to enable.
*
...
...
core/modules/config/src/Tests/ConfigOverrideTest.php
View file @
ae049e93
...
...
@@ -16,6 +16,15 @@
*/
class
ConfigOverrideTest
extends
KernelTestBase
{
/**
* Set to TRUE to strict check all configuration saved.
*
* @see \Drupal\Core\Config\Testing\ConfigSchemaChecker
*
* @var bool
*/
protected
$strictConfigSchema
=
TRUE
;
/**
* Modules to enable.
*
...
...
core/modules/config/src/Tests/ConfigSchemaTest.php
View file @
ae049e93
...
...
@@ -20,6 +20,15 @@
*/
class
ConfigSchemaTest
extends
KernelTestBase
{
/**
* Set to TRUE to strict check all configuration saved.
*
* @see \Drupal\Core\Config\Testing\ConfigSchemaChecker
*
* @var bool
*/
protected
$strictConfigSchema
=
TRUE
;
/**
* Modules to enable.
*
...
...
core/modules/config/src/Tests/SchemaCheckTraitTest.php
View file @
ae049e93
...
...
@@ -17,6 +17,16 @@
* @group config
*/
class
SchemaCheckTraitTest
extends
KernelTestBase
{
/**
* Set to TRUE to strict check all configuration saved.
*
* @see \Drupal\Core\Config\Testing\ConfigSchemaChecker
*
* @var bool
*/
protected
$strictConfigSchema
=
TRUE
;
use
SchemaCheckTrait
;
/**
...
...
core/modules/config/src/Tests/SchemaConfigListenerTest.php
View file @
ae049e93
...
...
@@ -35,12 +35,12 @@ public function testConfigSchemaChecker() {
// Test a non-existing schema.
$message
=
'Expected SchemaIncompleteException thrown'
;
try
{
\
Drupal
::
config
(
'config_schema_test.
noschema
'
)
->
set
(
'foo'
,
'bar'
)
->
save
();
\
Drupal
::
config
(
'config_schema_test.
schemaless
'
)
->
set
(
'foo'
,
'bar'
)
->
save
();
$this
->
fail
(
$message
);
}
catch
(
SchemaIncompleteException
$e
)
{
$this
->
pass
(
$message
);
$this
->
assertEqual
(
'No schema for config_schema_test.
noschema
'
,
$e
->
getMessage
());
$this
->
assertEqual
(
'No schema for config_schema_test.
schemaless
'
,
$e
->
getMessage
());
}
// Test a valid schema.
...
...
core/modules/config/src/Tests/SchemaConfigListenerWebTest.php
View file @
ae049e93
...
...
@@ -36,12 +36,12 @@ public function testConfigSchemaChecker() {
// Test a non-existing schema.
$msg
=
'Expected SchemaIncompleteException thrown'
;
try
{
\
Drupal
::
config
(
'config_schema_test.
noschema
'
)
->
set
(
'foo'
,
'bar'
)
->
save
();
\
Drupal
::
config
(
'config_schema_test.
schemaless
'
)
->
set
(
'foo'
,
'bar'
)
->
save
();
$this
->
fail
(
$msg
);
}
catch
(
SchemaIncompleteException
$e
)
{
$this
->
pass
(
$msg
);
$this
->
assertEqual
(
'No schema for config_schema_test.
noschema
'
,
$e
->
getMessage
());
$this
->
assertEqual
(
'No schema for config_schema_test.
schemaless
'
,
$e
->
getMessage
());
}
// Test a valid schema.
...
...
@@ -71,7 +71,7 @@ public function testConfigSchemaChecker() {
// Test that the config event listener is working in the child site.
$this
->
drupalGet
(
'config_test/schema_listener'
);
$this
->
assertText
(
'No schema for config_schema_test.
noschema
'
);
$this
->
assertText
(
'No schema for config_schema_test.
schemaless
'
);
}
}
core/modules/config/tests/config_collection_install_test/config/schema/config_collection_install_test.schema.yml
0 → 100644
View file @
ae049e93
config_collection_install_test.test
:
type
:
mapping
label
:
'
Collection
test'
mapping
:
collection
:
type
:
string
label
:
'
Collection'
core/modules/config/tests/config_events_test/config/schema/config_events_test.schema.yml
0 → 100644
View file @
ae049e93
config_events_test.test
:
type
:
mapping
label
:
'
Configuration
events
test'
mapping
:
key
:
type
:
string
label
:
'
Value'
core/modules/config/tests/config_test/config/schema/config_test.schema.yml
View file @
ae049e93
...
...
@@ -105,6 +105,44 @@ config_test.system:
foo
:
type
:
string
label
:
'
Foo'
baz
:
type
:
string
label
:
'
Baz'
'
404'
:
type
:
string
label
:
'
404'
config_test.new
:
type
:
mapping
label
:
'
Configuration
test'
mapping
:
key
:
type
:
string
label
:
'
Test
setting'
new_key
:
type
:
string
label
:
'
Test
setting'
uuid
:
type
:
string
label
:
'
UUID'
config_test.old
:
type
:
config_test.new
config_test.foo
:
type
:
mapping
label
:
'
Configuration
test'
mapping
:
value
:
type
:
mapping
label
:
'
Value'
mapping
:
key
:
type
:
string
label
:
'
Key'
label
:
type
:
label
label
:
'
Label'
config_test.bar
:
type
:
config_test.foo
core/modules/config/tests/config_test/src/Entity/ConfigQueryTest.php
View file @
ae049e93
...
...
@@ -43,6 +43,6 @@ class ConfigQueryTest extends ConfigTest {
*
* @var array
*/
public
$array
;
public
$array
=
array
()
;
}
core/modules/config/tests/config_test/src/SchemaListenerController.php
View file @
ae049e93
...
...
@@ -20,7 +20,7 @@ class SchemaListenerController extends ControllerBase {
*/
public
function
test
()
{
try
{
$this
->
config
(
'config_schema_test.
noschema
'
)
->
set
(
'foo'
,
'bar'
)
->
save
();
$this
->
config
(
'config_schema_test.
schemaless
'
)
->
set
(
'foo'
,
'bar'
)
->
save
();
}
catch
(
SchemaIncompleteException
$e
)
{
return
[
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment