Commit b78e3861 authored by git's avatar git Committed by Christian López Espínola
Browse files

Issue #3288313 by Project Update Bot: Automated Drupal 10 compatibility fixes

parent e702d40d
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -70,7 +70,7 @@ class LingotekConfigImportTest extends KernelTestBase {
    \Drupal::service('content_translation.manager')->setEnabled($entity_type_id, $entity_type_id, TRUE);

    // Verify the configuration to create does not exist yet.
    $this->assertIdentical($storage->exists($config_name), FALSE, $config_name . ' not found.');
    $this->assertSame($storage->exists($config_name), FALSE, $config_name . ' not found.');

    // Create new config entity for content language translation.
    $data = [
@@ -109,18 +109,18 @@ class LingotekConfigImportTest extends KernelTestBase {
      ],
    ];
    $sync->write($config_name, $data);
    $this->assertIdentical($sync->exists($config_name), TRUE, $config_name . ' found.');
    $this->assertSame($sync->exists($config_name), TRUE, $config_name . ' found.');

    // Import.
    $this->configImporter()->import();

    // Verify the values appeared.
    $config = $this->config($config_name);
    $this->assertIdentical($config->get('translate.entity.entity_test_mul.entity_test_mul.field.field_test_text'), TRUE);
    $this->assertSame($config->get('translate.entity.entity_test_mul.entity_test_mul.field.field_test_text'), TRUE);

    /** @var \Drupal\lingotek\LingotekConfigurationServiceInterface $lingotek_config */
    $lingotek_config = \Drupal::service('lingotek.configuration');
    $this->assertIdentical($lingotek_config->isEnabled($entity_type_id), TRUE);
    $this->assertSame($lingotek_config->isEnabled($entity_type_id), TRUE);
  }

}
+23 −23
Original line number Diff line number Diff line
@@ -87,24 +87,24 @@ class ChineseBulkTranslationTest extends LingotekTestBase {
    // And we can already request a translation.
    $this->assertLingotekRequestTranslationLink('zh_CN');
    $this->clickLink('EN');
    $this->assertText('The import for node Llamas are cool is complete.');
    $this->assertSession()->pageTextContains('The import for node Llamas are cool is complete.');

    // Request the German (AT) translation.
    $this->assertLingotekRequestTranslationLink('zh_CN');
    $this->clickLink('ZH');
    $this->assertText("Locale 'zh_CN' was added as a translation target for node Llamas are cool.");
    $this->assertSession()->pageTextContains("Locale 'zh_CN' was added as a translation target for node Llamas are cool.");
    // Check that the requested locale is the right one.
    $this->assertIdentical('zh_CN', \Drupal::state()->get('lingotek.added_target_locale'));
    $this->assertSame('zh_CN', \Drupal::state()->get('lingotek.added_target_locale'));

    // Check status of the Spanish translation.
    $this->assertLingotekCheckTargetStatusLink('zh_CN');
    $this->clickLink('ZH');
    $this->assertText('The zh_CN translation for node Llamas are cool is ready for download.');
    $this->assertSession()->pageTextContains('The zh_CN translation for node Llamas are cool is ready for download.');

    // Download the Spanish translation.
    $this->assertLingotekDownloadTargetLink('zh_CN');
    $this->clickLink('ZH');
    $this->assertText('The translation of node Llamas are cool into zh_CN has been downloaded.');
    $this->assertSession()->pageTextContains('The translation of node Llamas are cool into zh_CN has been downloaded.');

    // Now the link is to the workbench, and it opens in a new tab.
    $this->assertLingotekWorkbenchLink('zh_CN', 'dummy-document-hash-id', 'ZH-HANS');
@@ -133,34 +133,34 @@ class ChineseBulkTranslationTest extends LingotekTestBase {
    $assert_session->linkByHrefNotExists($basepath . '/admin/lingotek/config/request/system.site_information_settings/system.site_information_settings/zh_CN?destination=' . $basepath . '/admin/lingotek/config/manage');

    $this->clickLink('EN', 1);
    $this->assertText(t('System information uploaded successfully'));
    $this->assertIdentical('en_US', \Drupal::state()->get('lingotek.uploaded_locale'));
    $this->assertSession()->pageTextContains(t('System information uploaded successfully'));
    $this->assertSame('en_US', \Drupal::state()->get('lingotek.uploaded_locale'));

    // There is a link for checking status.
    $assert_session->linkByHrefExists($basepath . '/admin/lingotek/config/check_upload/system.site_information_settings/system.site_information_settings?destination=' . $basepath . '/admin/lingotek/config/manage');
    // And we can already request a translation.
    $assert_session->linkByHrefExists($basepath . '/admin/lingotek/config/request/system.site_information_settings/system.site_information_settings/zh_CN?destination=' . $basepath . '/admin/lingotek/config/manage');
    $this->clickLink('EN', 1);
    $this->assertText('System information status checked successfully');
    $this->assertSession()->pageTextContains('System information status checked successfully');

    // Request the Chinese translation.
    $assert_session->linkByHrefExists($basepath . '/admin/lingotek/config/request/system.site_information_settings/system.site_information_settings/zh_CN?destination=' . $basepath . '/admin/lingotek/config/manage');
    $this->clickLink('ZH');
    $this->assertText("Translation to zh_CN requested successfully");
    $this->assertSession()->pageTextContains("Translation to zh_CN requested successfully");
    // Check that the requested locale is the right one.
    $this->assertIdentical('zh_CN', \Drupal::state()->get('lingotek.added_target_locale'));
    $this->assertSame('zh_CN', \Drupal::state()->get('lingotek.added_target_locale'));

    // Check status of the Chinese translation.
    $assert_session->linkByHrefExists($basepath . '/admin/lingotek/config/check_download/system.site_information_settings/system.site_information_settings/zh_CN?destination=' . $basepath . '/admin/lingotek/config/manage');
    $this->clickLink('ZH');
    $this->assertIdentical('zh_CN', \Drupal::state()->get('lingotek.checked_target_locale'));
    $this->assertText("Translation to zh_CN checked successfully");
    $this->assertSame('zh_CN', \Drupal::state()->get('lingotek.checked_target_locale'));
    $this->assertSession()->pageTextContains("Translation to zh_CN checked successfully");

    // Download the Chinese translation.
    $assert_session->linkByHrefExists($basepath . '/admin/lingotek/config/download/system.site_information_settings/system.site_information_settings/zh_CN?destination=' . $basepath . '/admin/lingotek/config/manage');
    $this->clickLink('ZH');
    $this->assertText('Translation to zh_CN downloaded successfully');
    $this->assertIdentical('zh_CN', \Drupal::state()->get('lingotek.downloaded_locale'));
    $this->assertSession()->pageTextContains('Translation to zh_CN downloaded successfully');
    $this->assertSame('zh_CN', \Drupal::state()->get('lingotek.downloaded_locale'));

    // Now the link is to the workbench, and it opens in a new tab.
    $this->assertLingotekWorkbenchLink('zh_CN', 'dummy-document-hash-id', 'ZH-HANS');
@@ -188,33 +188,33 @@ class ChineseBulkTranslationTest extends LingotekTestBase {
    // And we cannot request yet a translation.
    $assert_session->linkByHrefNotExists($basepath . '/admin/lingotek/config/request/node_type/article/zh_CN?destination=' . $basepath . '/admin/lingotek/config/manage');
    $this->clickLink('EN');
    $this->assertText(t('Article uploaded successfully'));
    $this->assertIdentical('en_US', \Drupal::state()->get('lingotek.uploaded_locale'));
    $this->assertSession()->pageTextContains(t('Article uploaded successfully'));
    $this->assertSame('en_US', \Drupal::state()->get('lingotek.uploaded_locale'));

    // There is a link for checking status.
    $assert_session->linkByHrefExists($basepath . '/admin/lingotek/config/check_upload/node_type/article?destination=' . $basepath . '/admin/lingotek/config/manage');
    // And we can already request a translation.
    $assert_session->linkByHrefExists($basepath . '/admin/lingotek/config/request/node_type/article/zh_CN?destination=' . $basepath . '/admin/lingotek/config/manage');
    $this->clickLink('EN');
    $this->assertText('Article status checked successfully');
    $this->assertSession()->pageTextContains('Article status checked successfully');

    // Request the Spanish translation.
    $assert_session->linkByHrefExists($basepath . '/admin/lingotek/config/request/node_type/article/zh_CN?destination=' . $basepath . '/admin/lingotek/config/manage');
    $this->clickLink('ZH');
    $this->assertText("Translation to zh_CN requested successfully");
    $this->assertIdentical('zh_CN', \Drupal::state()->get('lingotek.added_target_locale'));
    $this->assertSession()->pageTextContains("Translation to zh_CN requested successfully");
    $this->assertSame('zh_CN', \Drupal::state()->get('lingotek.added_target_locale'));

    // Check status of the Spanish translation.
    $assert_session->linkByHrefExists($basepath . '/admin/lingotek/config/check_download/node_type/article/zh_CN?destination=' . $basepath . '/admin/lingotek/config/manage');
    $this->clickLink('ZH');
    $this->assertIdentical('zh_CN', \Drupal::state()->get('lingotek.checked_target_locale'));
    $this->assertText("Translation to zh_CN status checked successfully");
    $this->assertSame('zh_CN', \Drupal::state()->get('lingotek.checked_target_locale'));
    $this->assertSession()->pageTextContains("Translation to zh_CN status checked successfully");

    // Download the Spanish translation.
    $assert_session->linkByHrefExists($basepath . '/admin/lingotek/config/download/node_type/article/zh_CN?destination=' . $basepath . '/admin/lingotek/config/manage');
    $this->clickLink('ZH');
    $this->assertText('Translation to zh_CN downloaded successfully');
    $this->assertIdentical('zh_CN', \Drupal::state()->get('lingotek.downloaded_locale'));
    $this->assertSession()->pageTextContains('Translation to zh_CN downloaded successfully');
    $this->assertSame('zh_CN', \Drupal::state()->get('lingotek.downloaded_locale'));

    // Now the link is to the workbench, and it opens in a new tab.
    $this->assertLingotekWorkbenchLink('zh_CN', 'dummy-document-hash-id', 'ZH-HANS');
+5 −5
Original line number Diff line number Diff line
@@ -81,7 +81,7 @@ class LingotekNotificationControllerTest extends LingotekTestBase {
    $content_translation_service = \Drupal::service('lingotek.content_translation');

    // Assert the content is importing.
    $this->assertIdentical(Lingotek::STATUS_IMPORTING, $content_translation_service->getSourceStatus($node));
    $this->assertSame(Lingotek::STATUS_IMPORTING, $content_translation_service->getSourceStatus($node));

    $this->goToContentBulkManagementForm();

@@ -107,7 +107,7 @@ class LingotekNotificationControllerTest extends LingotekTestBase {

    $response = json_decode($request->getBody(), TRUE);
    $this->verbose($request);
    $this->assertIdentical(['es'], $response['result']['request_translations'], 'Spanish language has been requested after notification automatically.');
    $this->assertSame(['es'], $response['result']['request_translations'], 'Spanish language has been requested after notification automatically.');

    // Simulate again the notification of content successfully uploaded.
    $request = $this->client->get($url, [
@@ -122,7 +122,7 @@ class LingotekNotificationControllerTest extends LingotekTestBase {

    $response = json_decode($request->getBody(), TRUE);
    $this->verbose($request);
    $this->assertIdentical(['es'], $response['result']['request_translations'], 'Spanish language has been requested after notification automatically.');
    $this->assertSame(['es'], $response['result']['request_translations'], 'Spanish language has been requested after notification automatically.');
  }

  /**
@@ -147,7 +147,7 @@ class LingotekNotificationControllerTest extends LingotekTestBase {
    $this->assertStringContainsString('max-age=0', $cache_control_header[0]);

    $response = (string) $request->getBody();
    $this->assertIdentical($response, 'It works, but nothing to look here.');
    $this->assertSame($response, 'It works, but nothing to look here.');

    // Simulate again the notification of content successfully uploaded.
    $request = $this->client->get($url, [
@@ -161,7 +161,7 @@ class LingotekNotificationControllerTest extends LingotekTestBase {
    $this->assertStringContainsString('max-age=0', $cache_control_header[0]);

    $response = (string) $request->getBody();
    $this->assertIdentical($response, 'It works, but nothing to look here.');
    $this->assertSame($response, 'It works, but nothing to look here.');
  }

}
+3 −3
Original line number Diff line number Diff line
@@ -16,9 +16,9 @@ class LingotekSupportedLocalesControllerTest extends LingotekTestBase {
   */
  public function testSupportedLocales() {
    $this->drupalGet('/admin/lingotek/supported-locales');
    $this->assertText('German (Austria)');
    $this->assertText('German (Germany)');
    $this->assertText('Spanish (Spain)');
    $this->assertSession()->pageTextContains('German (Austria)');
    $this->assertSession()->pageTextContains('German (Germany)');
    $this->assertSession()->pageTextContains('Spanish (Spain)');
  }

}
+4 −4
Original line number Diff line number Diff line
@@ -76,15 +76,15 @@ class LingotekWorkbenchRedirectControllerTest extends LingotekTestBase {
    // The document should have been automatically uploaded, so let's check
    // the upload status.
    $this->clickLink('EN');
    $this->assertText('The import for node Llamas are cool is complete.');
    $this->assertSession()->pageTextContains('The import for node Llamas are cool is complete.');

    // Request translation.
    $this->clickLink('ES');
    $this->assertText("Locale 'es_AR' was added as a translation target for node Llamas are cool.");
    $this->assertSession()->pageTextContains("Locale 'es_AR' was added as a translation target for node Llamas are cool.");

    // Check translation status.
    $this->clickLink('ES');
    $this->assertText('The es_AR translation for node Llamas are cool is ready for download.');
    $this->assertSession()->pageTextContains('The es_AR translation for node Llamas are cool is ready for download.');

    // Download the Spanish translation.
    $this->assertLingotekDownloadTargetLink('es_AR');
@@ -97,7 +97,7 @@ class LingotekWorkbenchRedirectControllerTest extends LingotekTestBase {
    $this->clickLink('ES');

    $basepath = \Drupal::request()->getSchemeAndHttpHost();
    $this->assertUrl($basepath . '/workbench/document/dummy-document-hash-id/locale/es_AR');
    $this->assertSession()->addressEquals($basepath . '/workbench/document/dummy-document-hash-id/locale/es_AR');
  }

}
Loading