diff --git a/.drone.star b/.drone.star index 602d348a9f3b..751f11562c32 100644 --- a/.drone.star +++ b/.drone.star @@ -1338,7 +1338,7 @@ def acceptance(ctx): 'replaceUsernames': False, 'extraSetup': [], 'extraServices': [], - 'extraEnvironment': {}, + 'extraEnvironment': {'OC_LANGUAGE':'en-EN'}, 'extraCommandsBeforeTestRun': [], 'extraApps': {}, 'useBundledApp': False, diff --git a/tests/TestHelpers/TranslationHelper.php b/tests/TestHelpers/TranslationHelper.php new file mode 100644 index 000000000000..6adac964929c --- /dev/null +++ b/tests/TestHelpers/TranslationHelper.php @@ -0,0 +1,45 @@ + + * @copyright Copyright (c) 2021 Talank Baral talank@jankaritech.com + * + * This code is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License, + * as published by the Free Software Foundation; + * either version 3 of the License, or any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + */ +namespace TestHelpers; + +/** + * Class TranslationHelper + * + * Helper functions that are needed to run tests on different languages + * + * @package TestHelpers + */ +class TranslationHelper { + /** + * @param $language + * + * @return string + */ + public static function getLanguage($language) { + if (!isset($language)) { + if (\getenv('OC_LANGUAGE') !== false) { + $language = \getenv('OC_LANGUAGE'); + } + } + return $language; + } +} diff --git a/tests/acceptance/features/bootstrap/OCSContext.php b/tests/acceptance/features/bootstrap/OCSContext.php index 4c8f029180b1..1d510d897db0 100644 --- a/tests/acceptance/features/bootstrap/OCSContext.php +++ b/tests/acceptance/features/bootstrap/OCSContext.php @@ -27,6 +27,7 @@ use Psr\Http\Message\ResponseInterface; use PHPUnit\Framework\Assert; use TestHelpers\OcsApiHelper; +use TestHelpers\TranslationHelper; require_once 'bootstrap.php'; @@ -713,6 +714,7 @@ public function theOcsStatusCodeShouldBeOr($statusCode1, $statusCode2) { * @return void */ public function theOCSStatusMessageShouldBe($statusMessage, $language=null) { + $language = TranslationHelper::getLanguage($language); $statusMessage = $this->getActualStatusMessage($statusMessage, $language); Assert::assertEquals( diff --git a/tests/acceptance/features/bootstrap/Sharing.php b/tests/acceptance/features/bootstrap/Sharing.php index 63c39aed2567..d34817461d76 100644 --- a/tests/acceptance/features/bootstrap/Sharing.php +++ b/tests/acceptance/features/bootstrap/Sharing.php @@ -29,6 +29,7 @@ use TestHelpers\OcisHelper; use TestHelpers\SharingHelper; use TestHelpers\HttpRequestHelper; +use TestHelpers\TranslationHelper; /** * Sharing trait @@ -1631,6 +1632,7 @@ public function theUserGetsInfoOfLastShareUsingTheSharingApi() { */ public function userGetsInfoOfLastShareUsingTheSharingApi($user, $language=null) { $share_id = $this->getLastShareIdOf($user); + $language = TranslationHelper::getLanguage($language); $this->getShareData($user, $share_id, $language); }