Because in destruct() there is a foreach which triggers
Invalid argument supplied for foreach()

patch coming

Files: 
CommentFileSizeAuthor
#14 drupal-locale-2018409-14.patch3.05 KBParisLiakos
PASSED: [[SimpleTest]]: [MySQL] 56,216 pass(es).
[ View ]
#10 drupal-locale-2018409-10.patch3.47 KBParisLiakos
PASSED: [[SimpleTest]]: [MySQL] 57,536 pass(es).
[ View ]
#10 interdiff.txt821 bytesParisLiakos
#7 interdiff.txt1.3 KBParisLiakos
#6 drupal-locale-2018409-6.patch3.47 KBParisLiakos
PASSED: [[SimpleTest]]: [MySQL] 56,154 pass(es).
[ View ]
#3 drupal-locale-2018409-3.patch3.29 KBParisLiakos
PASSED: [[SimpleTest]]: [MySQL] 57,619 pass(es).
[ View ]
#1 drupal-locale-2018409-1-FAIL.patch1.82 KBParisLiakos
FAILED: [[SimpleTest]]: [MySQL] Failed to run tests: failed during invocation of run-tests.sh.
[ View ]
#1 drupal-locale-2018409-1.patch2.14 KBParisLiakos
FAILED: [[SimpleTest]]: [MySQL] Failed to run tests: failed during invocation of run-tests.sh.
[ View ]

Comments

ParisLiakos’s picture

Status:Active» Needs review
StatusFileSize
new2.14 KB
FAILED: [[SimpleTest]]: [MySQL] Failed to run tests: failed during invocation of run-tests.sh.
[ View ]
new1.82 KB
FAILED: [[SimpleTest]]: [MySQL] Failed to run tests: failed during invocation of run-tests.sh.
[ View ]

Status:Needs review» Needs work

The last submitted patch, drupal-locale-2018409-1.patch, failed testing.

ParisLiakos’s picture

Status:Needs work» Needs review
StatusFileSize
new3.29 KB
PASSED: [[SimpleTest]]: [MySQL] 57,619 pass(es).
[ View ]

ok, there is a webtest with the same name...so, lets move it to the StringTranslation\Translator namespace that core uses to be consistent and avoid namespace collision with webtest

dawehner’s picture

+1 for moving the file.

+++ b/core/modules/locale/tests/Drupal/locale/Tests/StringTranslation/Translator/LocaleTranslationTest.phpundefined
@@ -0,0 +1,47 @@
+  /**
+   * A mocked storage to use when instantiating LocaleTranslation objects.
+   */
+  protected $storage;

You could document the type of this variable.

+++ b/core/modules/locale/tests/Drupal/locale/Tests/StringTranslation/Translator/LocaleTranslationTest.phpundefined
@@ -0,0 +1,47 @@
+  public function setUp() {

and @inheritdoc

+++ b/core/modules/locale/tests/Drupal/locale/Tests/StringTranslation/Translator/LocaleTranslationTest.phpundefined
@@ -0,0 +1,47 @@
+    $translation = new LocaleTranslation($this->storage);
+    // Prove that destruction works without errors.
+    $translation->destruct();

Can't we test what actually was done? For example assertAttributeEmpty?

Berdir’s picture

Priority:Normal» Major

@dawehner: Nothing was done, as expected. To add more tests to actually let it do something, we first need the refactoring that's happening in the cache collector issue, which will allow to inject and mock all dependencies properly. So wondering if we want to get that in first and then add more tests here, or just get it in like this and extend later.

Raising to major, this is logging a php warning to watchdog for every request you make when locale is enabled and you're using english/system language.

ParisLiakos’s picture

StatusFileSize
new3.47 KB
PASSED: [[SimpleTest]]: [MySQL] 56,154 pass(es).
[ View ]

yeah, we cant properly unit-test this now..its just as quick fix for the notice.
here is with improvements

ParisLiakos’s picture

StatusFileSize
new1.3 KB

forgot the interdiff

Gábor Hojtsy’s picture

Status:Needs review» Needs work
Issue tags:+D8MI, +language-base
index 0c405dd..4957106 100644
--- a/core/modules/locale/lib/Drupal/locale/LocaleTranslation.php

--- a/core/modules/locale/lib/Drupal/locale/LocaleTranslation.php
+++ b/core/modules/locale/lib/Drupal/locale/StringTranslation/Translator/LocaleTranslation.phpundefined

Is the move to this new place arbitrary or is there any rule that this would be placed here? Seems like arbitrary based on the services association taking whatever location desired.

+++ b/core/modules/locale/tests/Drupal/locale/Tests/StringTranslation/Translator/LocaleTranslationTest.phpundefined
@@ -0,0 +1,53 @@
+      'name' => 'Locale translation tests',
+      'description' => 'Test locale module translatiob implementation.',

translatiob typo :)

Also, if there is already a webtest named like this, should we be more specific explaining what is happening here?

ParisLiakos’s picture

Issue tags:-D8MI, -language-base

The webtest named LocaleTranslationTest tests the interface translation..i could rename this to LocaleTranslationUiTest maybe?
but we already follow core/lib/Drupal/Core's namespaces in modules, like controllers, forms, plugins..so this is not something new

ParisLiakos’s picture

Status:Needs work» Needs review
Issue tags:+D8MI, +language-base
StatusFileSize
new821 bytes
new3.47 KB
PASSED: [[SimpleTest]]: [MySQL] 57,536 pass(es).
[ View ]

Restoring tags and fixing typo

Gábor Hojtsy’s picture

Yeah renaming the UI test to ...UiTest would be good :)

pwieck’s picture

*UPDATED*

This patch fixed error

Warning: Invalid argument supplied for foreach() in Drupal\locale\LocaleTranslation->destruct() (line 80 of /xxx/xxx/xxx/drupal/core/modules/locale/lib/Drupal/locale/LocaleTranslation.php).

Berdir’s picture

Yes, that's exactly what this fixes.

ParisLiakos’s picture

Issue tags:+Quick fix
StatusFileSize
new3.05 KB
PASSED: [[SimpleTest]]: [MySQL] 56,216 pass(es).
[ View ]

totally forgot this sorry...
and just did #11 but eventually with the file moves i messed up the interdifff, really sorry..but its a small patch, so here it is, lets hope will have no problems

dawehner’s picture

Status:Needs review» Reviewed & tested by the community

Okay, let's keep it simple for now.

alexpott’s picture

Status:Reviewed & tested by the community» Fixed

Committed 90c2c23 and pushed to 8.x. Thanks!

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