Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ParisLiakos’s picture

Status: Active » Needs review
FileSize
2.14 KB
1.82 KB

Status: Needs review » Needs work

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

ParisLiakos’s picture

Status: Needs work » Needs review
FileSize
3.29 KB

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

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

ParisLiakos’s picture

FileSize
1.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
FileSize
821 bytes
3.47 KB

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
FileSize
3.05 KB

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.