From a44dbd7a5cc49e347dcdcc6f998247a29f23474e Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Mon, 21 Nov 2022 14:32:19 -0800 Subject: [PATCH] E2E\Api4\LocaleTest - Update to reflect current reality --- tests/phpunit/E2E/Api4/LocaleTest.php | 34 +++++++++++++++++++++------ 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/tests/phpunit/E2E/Api4/LocaleTest.php b/tests/phpunit/E2E/Api4/LocaleTest.php index c8356fbc12..097733be8c 100644 --- a/tests/phpunit/E2E/Api4/LocaleTest.php +++ b/tests/phpunit/E2E/Api4/LocaleTest.php @@ -15,21 +15,37 @@ class LocaleTest extends \CiviEndToEndTestCase { public function getLanguageExamples(): array { $results = []; switch (CIVICRM_UF) { - case 'Drupal': - case 'Drupal8': case 'Backdrop': + // FIXME: In buildkit.git:app/config/backdrop-*, it downloads the *.po files, but it lacks drush support for activating them. + $results[] = ['*SKIP*', NULL, NULL, NULL, NULL]; + break; + + case 'Drupal': $results[] = ['de_DE', 'de_CH', 't', 'Yes', 'Ja']; - // That's weird -- you install Drupal's "de", and you do `setUFLocale('de_DE')`, and - // the result is... to report back as 'de_DE'. Weird. But the actual string is OK... + // That's weird... If you install Drupal's "de", and if you do `setUFLocale('de_DE')`, if + // you lookup `getUFLocale()`... then it reports back as 'de_CH'. Feels arbitrary. + // OTOH, D7 doesn't appear to distinguish national dialects, so `de_DE` and `de_CH` are the same thing... break; - case 'WordPress': - $results[] = ['de_DE', 'de_DE', '__', 'Yes', 'Ja']; + case 'Drupal8': + // FIXME: In buildkit.git:app/config/drupal8-*, it downloads the *.po files, but it lacks drush support for activating them. + $results[] = ['*SKIP*', NULL, NULL, NULL, NULL]; break; case 'Joomla': + // FIXME: In CRM_Utils_System_Joomla, the setUFLocale and getUFLocale are not fully implemented. + // FIXME: In buildkit.git:app/config/joomla-*, it does not enable any languages. + $results[] = ['*SKIP*', NULL, NULL, NULL, NULL]; + break; + + case 'WordPress': + // FIXME: In CRM_Utils_System_WordPress, the setUFLocale and getUFLocale are not fully implemented. + // FIXME: In buildkit.git:app/config/wp-*, it does not enable any languages. + $results[] = ['*SKIP*', NULL, NULL, NULL, NULL]; + // $results[] = ['de_DE', 'de_DE', '__', 'Yes', 'Ja']; + break; + default: - $this->fail('Test not implemented for ' . CIVICRM_UF); } return $results; } @@ -56,6 +72,10 @@ class LocaleTest extends \CiviEndToEndTestCase { * @dataProvider getLanguageExamples */ public function testSetLanguage($civiLocale, $expectUfLocale, $translator, $inputString, $expectString) { + if ($civiLocale === '*SKIP*') { + $this->markTestIncomplete('Current environment does not support testing of UF locale.'); + } + $actualStrings = []; $actualLocales = []; \Civi::dispatcher()->addListener('civi.api.respond', function (RespondEvent $e) use (&$actualStrings, &$actualLocales, $translator, $inputString, $civiLocale) { -- 2.25.1