Problem/Motivation

1. Install Drupal in German.
2. Add French.
3. Go to the German language, create a View. View is created in German. Yay.
4. Go to the French language, create a View. View is still created in German. Nay.

Proposed resolution

Use the negotiated language when defaulting config entity languages.

Remaining tasks

Discuss. Review.

User interface changes

None.

API changes

Default assumptions about config entity language changes. Will only be an actual change on multilingual sites and there the new behavior makes sense, the old one does not.

Files: 
CommentFileSizeAuthor
#11 interdiff.txt2.12 KBGábor Hojtsy
#11 2447139-11.patch2.95 KBGábor Hojtsy
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 88,799 pass(es). View
#8 interdiff.txt1.62 KBGábor Hojtsy
#8 2447139-8.patch2.5 KBGábor Hojtsy
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 88,124 pass(es). View
#5 interdiff.txt781 bytesGábor Hojtsy
#5 2447139-5.patch1.61 KBGábor Hojtsy
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 87,997 pass(es). View
#1 2447139.patch863 bytesGábor Hojtsy
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] Failed to run tests: PHP Fatal error encountered during run_tests.sh. See review log for details.. View

Comments

Gábor Hojtsy’s picture

FileSize
863 bytes
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] Failed to run tests: PHP Fatal error encountered during run_tests.sh. See review log for details.. View
Gábor Hojtsy’s picture

Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, 1: 2447139.patch, failed testing.

Gábor Hojtsy’s picture

It is not clear to me how to tell from the results which test fails exactly. I tried the tests listed around that fatal locally but neither failed. I don't think the code needs fixing, the test needs fixing to define what is missing.

Gábor Hojtsy’s picture

Status: Needs work » Needs review
FileSize
1.61 KB
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 87,997 pass(es). View
781 bytes

Discussed clever ways to figure out which test was that with Wim Leers and vijaycs85 and we found \Drupal\Tests\Core\Config\Entity\ConfigEntityStorageTest. That of course now needs to return English for the current language then.

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

Ah there is the issue!

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs tests

Looks like we should have a test for this - I'm not sure that the test change actually covers the bug being fixed by the patch.

Gábor Hojtsy’s picture

Status: Needs work » Needs review
FileSize
2.5 KB
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 88,124 pass(es). View
1.62 KB

Updated tests to ensure that the language default is applied based on current language.

Gábor Hojtsy’s picture

Issue tags: -Needs tests
dawehner’s picture

Status: Needs review » Reviewed & tested by the community

Looks great, but some integration test would be great.

+++ b/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityStorageTest.php
@@ -139,8 +139,12 @@ protected function setUp() {
+      ->will($this->returnValue(new Language(array('id' => 'hu'))));

Just a comment: For future uses, you can use ->willReturn(new Language(...

Gábor Hojtsy’s picture

Title: Config entities should be created in the page's language » Config entities should be created in the negotiated language unless otherwise specified
Status: Reviewed & tested by the community » Needs review
FileSize
2.95 KB
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 88,799 pass(es). View
2.12 KB

Using willReturn() and more coverage for when you did provide a language. The change is in config entity storage, so I think it makes sense to test it there, that applies the default. This should be more complete coverage now.

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

Looks alright for me!

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

This issue is a normal bug fix, and doesn't include any disruptive changes, so it is allowed per https://www.drupal.org/core/beta-changes. Committed be30a52 and pushed to 8.0.x. Thanks!

  • alexpott committed be30a52 on 8.0.x
    Issue #2447139 by Gábor Hojtsy: Config entities should be created in the...
Gábor Hojtsy’s picture

Issue tags: -sprint

Yay, thanks!

Status: Fixed » Closed (fixed)

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