Problem/Motivation

In the FileStorage.php at line #118, whitespace is incorrectly used when concatenating variables forming a sentence.

Proposed resolution

Fix it.

Remaining tasks

Test, RTBC, commit, release.

User interface changes

See before/after comparison screenshot of CLI:
Screenshot

API changes

n.a.

Data model changes

n.a.

Release notes snippet

n.a.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Balu Ertl created an issue. See original summary.

Balu Ertl’s picture

larowlan’s picture

Status: Needs review » Needs work
Issue tags: +Needs tests, +Bug Smash Initiative

I'm guessing we don't have tests for this, so given this is a bug, we should probably add one

We already have \Drupal\KernelTests\Core\Config\Storage\FileStorageTest::testReadUnsupportedDataTypeConfigException which is covering that code path, so we could probably modify it to cover the actual message

Thanks for this

jungle’s picture

Status: Needs work » Needs review
Issue tags: -Needs tests
FileSize
2.14 KB
1.42 KB

Test added.

jungle’s picture

FileSize
735 bytes
2.2 KB
+++ b/core/tests/Drupal/KernelTests/Core/Config/Storage/FileStorageTest.php
@@ -73,17 +73,15 @@ public function testlistAll() {
+   * Tests UnsupportedDataTypeConfigException.
...
   public function testReadUnsupportedDataTypeConfigException() {

Let the method name inline with the comment.

Status: Needs review » Needs work

The last submitted patch, 5: 3181272-5.patch, failed testing. View results

jungle’s picture

Status: Needs work » Needs review
FileSize
2.22 KB
1.02 KB

Trying to fix the failed test.

Status: Needs review » Needs work

The last submitted patch, 7: 3181272-7.patch, failed testing. View results

jungle’s picture

Status: Needs work » Needs review
FileSize
1.13 KB
2.25 KB

Another try

Status: Needs review » Needs work

The last submitted patch, 9: 3181272-9.patch, failed testing. View results

jungle’s picture

Help needed, the expected error messages are different between local and CI.

longwave’s picture

There are at least two possible YAML parsers - there is a PECL extension (which it looks like DrupalCI has enabled), and the Symfony Yaml component. They have slightly different error messages.

I think you might have to catch the exception and use assertStringContainsString on the exception message like the original test did.

longwave’s picture

Status: Needs work » Needs review
FileSize
2.12 KB
1.19 KB
longwave’s picture

FileSize
2.14 KB
1000 bytes

In fact there is a simpler way.

jungle’s picture

Status: Needs review » Reviewed & tested by the community

#12, make sense, thanks, @longwave!

+++ b/core/tests/Drupal/KernelTests/Core/Config/Storage/FileStorageTest.php
@@ -73,17 +73,15 @@ public function testlistAll() {
-      $this->assertStringContainsString($this->storage->getFilePath('core.extension'), $e->getMessage(), 'Erroneous file path is displayed.');
...
+    $this->expectExceptionMessageMatches("@Invalid data type in config $name, found in file $path: @");

Although not the whole error message gets asserted, it is better than the original.

  • catch committed 08e2290 on 9.2.x
    Issue #3181272 by jungle, longwave, Balu Ertl, larowlan: Fix typo in...

  • catch committed e27bd85 on 9.1.x
    Issue #3181272 by jungle, longwave, Balu Ertl, larowlan: Fix typo in...

  • catch committed 4839e85 on 8.9.x
    Issue #3181272 by jungle, longwave, Balu Ertl, larowlan: Fix typo in...
catch’s picture

Version: 9.2.x-dev » 8.9.x-dev
Status: Reviewed & tested by the community » Fixed

Committed/pushed to 9.2.x, and cherry-picked to 9.1.x and 8.9.x, thanks!

drumm’s picture

The version change didn’t quite stick everywhere due to some race condition. Just updating to flush that out.

  • alexpott committed a3e497b on 8.9.x
    Revert "Issue #3181272 by jungle, longwave, Balu Ertl, larowlan: Fix...
alexpott’s picture

Version: 8.9.x-dev » 9.1.x-dev

Reverted from 8.9.x as this change broke tests there.

alexpott’s picture

I think the problem is caused by different symfony yaml version in D8/D9.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.