diff --git a/core/lib/Drupal/Core/Config/Schema/SchemaCheckTrait.php b/core/lib/Drupal/Core/Config/Schema/SchemaCheckTrait.php index 0fccd47..5127adc 100644 --- a/core/lib/Drupal/Core/Config/Schema/SchemaCheckTrait.php +++ b/core/lib/Drupal/Core/Config/Schema/SchemaCheckTrait.php @@ -81,7 +81,7 @@ protected function checkValue($key, $value) { $error_key = $this->configName . ':' . $key; $element = $this->schema->get($key); if ($element instanceof Undefined) { - return array($error_key => 'Missing schema.'); + return array($error_key => 'missing schema'); } // Do not check value if it is defined to be ignored. @@ -104,13 +104,13 @@ protected function checkValue($key, $value) { } $class = get_class($element); if (!$success) { - return array($error_key => "Variable type is $type but applied schema class is $class."); + return array($error_key => "variable type is $type but applied schema class is $class"); } } else { $errors = array(); if (!$element instanceof TraversableTypedDataInterface) { - $errors[$error_key] = 'Non-scalar value but not defined as an array (such as mapping or sequence).'; + $errors[$error_key] = 'non-scalar value but not defined as an array (such as mapping or sequence)'; } // Go on processing so we can get errors on all levels. Any non-scalar diff --git a/core/lib/Drupal/Core/Config/Testing/ConfigSchemaChecker.php b/core/lib/Drupal/Core/Config/Testing/ConfigSchemaChecker.php index 421071b..db80944 100644 --- a/core/lib/Drupal/Core/Config/Testing/ConfigSchemaChecker.php +++ b/core/lib/Drupal/Core/Config/Testing/ConfigSchemaChecker.php @@ -55,7 +55,7 @@ public function __construct(TypedConfigManagerInterface $typed_manager) { /** * Checks that configuration complies with its schema on config save. * - * @param ConfigCrudEvent $event + * @param \Drupal\Core\Config\ConfigCrudEvent $event * The configuration event. * * @throws \Drupal\Core\Config\Schema\SchemaIncompleteException @@ -75,7 +75,7 @@ public function onConfigSave(ConfigCrudEvent $event) { elseif (is_array($errors)) { $text_errors = []; foreach ($errors as $key => $error) { - $text_errors[] = String::format('@key: @error', array('@key' => $key, '@error' => $error)); + $text_errors[] = String::format('@key @error', array('@key' => $key, '@error' => $error)); } throw new SchemaIncompleteException(String::format('Schema errors for @config_name with the following errors: @errors', array('@config_name' => $name, '@errors' => implode(', ', $text_errors)))); } diff --git a/core/modules/config/src/Tests/SchemaCheckTestTrait.php b/core/modules/config/src/Tests/SchemaCheckTestTrait.php index c5b4cba..3a88296 100644 --- a/core/modules/config/src/Tests/SchemaCheckTestTrait.php +++ b/core/modules/config/src/Tests/SchemaCheckTestTrait.php @@ -45,7 +45,7 @@ public function assertConfigSchema(TypedConfigManagerInterface $typed_config, $c foreach ($errors as $key => $error) { // @todo Since the use of this trait is under TestBase, it works. // Can be fixed as part of https://drupal.org/node/2260053. - $this->fail($key . ': ' . $error); + $this->fail(String::format('Schema key @key failed with: @error', array('@key' => $key, '@error' => $error))); } } } diff --git a/core/modules/config/src/Tests/SchemaCheckTraitTest.php b/core/modules/config/src/Tests/SchemaCheckTraitTest.php index 890eed8..450d4f1 100644 --- a/core/modules/config/src/Tests/SchemaCheckTraitTest.php +++ b/core/modules/config/src/Tests/SchemaCheckTraitTest.php @@ -61,9 +61,9 @@ public function testTrait() { $config_data['boolean'] = array(); $ret = $this->checkConfigSchema($this->typedConfig, 'config_test.types', $config_data); $expected = array( - 'config_test.types:new_key' => 'Missing schema.', - 'config_test.types:new_array' => 'Missing schema.', - 'config_test.types:boolean' => 'Non-scalar value but not defined as an array (such as mapping or sequence).', + 'config_test.types:new_key' => 'missing schema', + 'config_test.types:new_array' => 'missing schema', + 'config_test.types:boolean' => 'non-scalar value but not defined as an array (such as mapping or sequence)', ); $this->assertIdentical($ret, $expected); } diff --git a/core/modules/config/src/Tests/SchemaConfigListenerTest.php b/core/modules/config/src/Tests/SchemaConfigListenerTest.php index 4796547..84bf60e 100644 --- a/core/modules/config/src/Tests/SchemaConfigListenerTest.php +++ b/core/modules/config/src/Tests/SchemaConfigListenerTest.php @@ -32,40 +32,40 @@ class SchemaConfigListenerTest extends KernelTestBase { * Tests \Drupal\Core\Config\Testing\ConfigSchemaChecker. */ public function testConfigSchemaChecker() { - // Test a non existing schema. - $msg = 'Expected SchemaIncompleteException thrown'; + // Test a non-existing schema. + $message = 'Expected SchemaIncompleteException thrown'; try { \Drupal::config('config_schema_test.noschema')->set('foo', 'bar')->save(); - $this->fail($msg); + $this->fail($message); } catch (SchemaIncompleteException $e) { - $this->pass($msg); + $this->pass($message); $this->assertEqual('No schema for config_schema_test.noschema', $e->getMessage()); } // Test a valid schema. - $msg = 'Unexpected SchemaIncompleteException thrown'; + $message = 'Unexpected SchemaIncompleteException thrown'; $config = \Drupal::config('config_test.types')->set('int', 10); try { $config->save(); - $this->pass($msg); + $this->pass($message); } catch (SchemaIncompleteException $e) { - $this->fail($msg); + $this->fail($message); } // Test an invalid schema. - $msg = 'Expected SchemaIncompleteException thrown'; + $message = 'Expected SchemaIncompleteException thrown'; $config = \Drupal::config('config_test.types') ->set('foo', 'bar') ->set('array', 1); try { $config->save(); - $this->fail($msg); + $this->fail($message); } catch (SchemaIncompleteException $e) { - $this->pass($msg); - $this->pass('Schema errors for config_test.types with the following errors: config_test.types:foo: Missing schema., config_test.types:array: Variable type is integer but applied schema class is Drupal\Core\Config\Schema\Sequence.'); + $this->pass($message); + $this->assertEqual('Schema errors for config_test.types with the following errors: config_test.types:foo missing schema, config_test.types:array variable type is integer but applied schema class is Drupal\Core\Config\Schema\Sequence', $e->getMessage()); } } diff --git a/core/modules/config/src/Tests/SchemaConfigListenerWebTest.php b/core/modules/config/src/Tests/SchemaConfigListenerWebTest.php index 86e28d9..10ddc7b 100644 --- a/core/modules/config/src/Tests/SchemaConfigListenerWebTest.php +++ b/core/modules/config/src/Tests/SchemaConfigListenerWebTest.php @@ -33,7 +33,7 @@ class SchemaConfigListenerWebTest extends WebTestBase { * Tests \Drupal\Core\Config\Testing\ConfigSchemaChecker. */ public function testConfigSchemaChecker() { - // Test a non existing schema. + // Test a non-existing schema. $msg = 'Expected SchemaIncompleteException thrown'; try { \Drupal::config('config_schema_test.noschema')->set('foo', 'bar')->save(); @@ -66,7 +66,7 @@ public function testConfigSchemaChecker() { } catch (SchemaIncompleteException $e) { $this->pass($msg); - $this->pass('Schema errors for config_test.types with the following errors: config_test.types:foo: Missing schema., config_test.types:array: Variable type is integer but applied schema class is Drupal\Core\Config\Schema\Sequence.'); + $this->assertEqual('Schema errors for config_test.types with the following errors: config_test.types:array variable type is integer but applied schema class is Drupal\Core\Config\Schema\Sequence, config_test.types:foo missing schema', $e->getMessage()); } // Test that the config event listener is working in the child site. diff --git a/core/modules/system/src/Tests/Menu/MenuTreeStorageTest.php b/core/modules/system/src/Tests/Menu/MenuTreeStorageTest.php index a923e9b..39c403c 100644 --- a/core/modules/system/src/Tests/Menu/MenuTreeStorageTest.php +++ b/core/modules/system/src/Tests/Menu/MenuTreeStorageTest.php @@ -307,15 +307,15 @@ public function testLoadByProperties() { array('foo' => 'bar'), array(0 => 'wrong'), ); - $msg = 'An invalid property name throws an exception.'; + $message = 'An invalid property name throws an exception.'; foreach ($tests as $properties) { try { $this->treeStorage->loadByProperties($properties); - $this->fail($msg); + $this->fail($message); } catch (\InvalidArgumentException $e) { $this->assertTrue(preg_match('/^An invalid property name, .+ was specified. Allowed property names are:/', $e->getMessage()), 'Found expected exception message.'); - $this->pass($msg); + $this->pass($message); } } $this->addMenuLink('test_link.1', '', 'test', array(), 'menu1');