Add a test for a config entity. Eg. a contact category. We can set it to a foreign language and check if it applies to the front page. The existing tests don't test config entity translation. Maybe add more than one language, and visit the contact page in different languages to see all apply appropriately.

Comments

vijaycs85’s picture

Status: Active » Needs review
StatusFileSize
new3.89 KB

Adding test case that

1. Enable multiple language
2. Update translation of label/title & auto-reply text of feedback - contact form
3. Validate text in #2 by visiting feedback form and sending mail.

gábor hojtsy’s picture

Status: Needs review » Needs work

Good find with the email grabbing utility function :) Looks like a solid patch, just relatively minor comments.

+++ b/lib/Drupal/config_translation/Tests/ConfigTranslationUITest.phpundefined
@@ -20,7 +20,14 @@ class ConfigTranslationUITest extends WebTestBase {
+  /**
+   * Languages to enable.
+   *
+   * @var array
+   */
+  protected $languages = array('fr', 'ta');
 

Make this $langcodes. $languages would be an array of language objects.

+++ b/lib/Drupal/config_translation/Tests/ConfigTranslationUITest.phpundefined
@@ -151,6 +166,60 @@ class ConfigTranslationUITest extends WebTestBase {
   /**
+   * Test case for site information translation interface.
+   */

Contact category translation, right? :)

+++ b/lib/Drupal/config_translation/Tests/ConfigTranslationUITest.phpundefined
@@ -151,6 +166,60 @@ class ConfigTranslationUITest extends WebTestBase {
+    // Check for default contact form config entity from Contact module.
+    $this->assertLinkByHref('admin/structure/contact/manage/feedback/edit');
+
+    // Visit page to check to update details and check for translation tab.
+    $this->assertLinkByHref('admin/structure/contact/manage/feedback/edit');

These two do the same thing? I think what you wanted is to go to 'contact/feedback' after the drupalPost below and check the original language versions?

+++ b/lib/Drupal/config_translation/Tests/ConfigTranslationUITest.phpundefined
@@ -151,6 +166,60 @@ class ConfigTranslationUITest extends WebTestBase {
+    // Keep it out of loop, as state() capture all emails.

// We get all emails so no need to check inside the loop.

+++ b/lib/Drupal/config_translation/Tests/ConfigTranslationUITest.phpundefined
@@ -151,6 +166,60 @@ class ConfigTranslationUITest extends WebTestBase {
+        // Needs trim as getting new line at end.

// Trim because we get an added newline for the body.

vijaycs85’s picture

Status: Needs work » Needs review
StatusFileSize
new2.9 KB
new3.88 KB

Thanks for the review @Gábor Hojtsy. fixed them all.

gábor hojtsy’s picture

Status: Needs review » Fixed

Thanks, committed.

Status: Fixed » Closed (fixed)

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