Skip to content

Commit aee9ad4

Browse files
committed
Added json file to store translated messages
1 parent 25f0343 commit aee9ad4

File tree

3 files changed

+33
-15
lines changed

3 files changed

+33
-15
lines changed

tests/acceptance/features/apiTranslation/translation.feature

+11-14
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,16 @@ Feature: translate messages in api response to preferred language
1212
| Carol |
1313
And using <dav_version> DAV path
1414
And user "Brian" has shared file "textfile0.txt" with user "Carol"
15-
When user "Alice" gets the info of the last share in language "de-DE" using the sharing API
15+
When user "Alice" gets the info of the last share in language "<language>" using the sharing API
1616
Then the OCS status code should be "404"
17-
And the OCS status message should be "Fehlerhafte Freigabe-ID, Freigabe existiert nicht"
18-
When user "Alice" gets the info of the last share in language "zh-CN" using the sharing API
19-
Then the OCS status code should be "404"
20-
And the OCS status message should be "错误的共享 ID,共享不存在"
21-
When user "Alice" gets the info of the last share in language "fr-FR" using the sharing API
22-
Then the OCS status code should be "404"
23-
And the OCS status message should be "Mauvais ID de partage, le partage n'existe pas"
24-
When user "Alice" gets the info of the last share in language "es-ES" using the sharing API
25-
Then the OCS status code should be "404"
26-
And the OCS status message should be "El ID del recurso compartido no es correcto, el recurso compartido no existe"
17+
And the OCS status message should be "Wrong share ID, share doesn't exist" in language "<language>"
2718
Examples:
28-
| dav_version |
29-
| old |
30-
| new |
19+
| dav_version | language |
20+
| old | de-DE |
21+
| new | de-DE |
22+
| old | zh-CN |
23+
| new | zh-CN |
24+
| old | fr-FR |
25+
| new | fr-FR |
26+
| old | es-ES |
27+
| new | es-ES |

tests/acceptance/features/bootstrap/OCSContext.php

+14-1
Original file line numberDiff line numberDiff line change
@@ -698,12 +698,25 @@ public function theOcsStatusCodeShouldBeOr($statusCode1, $statusCode2) {
698698
* Check the text in an OCS status message
699699
*
700700
* @Then /^the OCS status message should be "([^"]*)"$/
701+
* @Then /^the OCS status message should be "([^"]*)" in language "([^"]*)"$/
701702
*
702703
* @param string $statusMessage
704+
* @param string $language
703705
*
704706
* @return void
705707
*/
706-
public function theOCSStatusMessageShouldBe($statusMessage) {
708+
public function theOCSStatusMessageShouldBe($statusMessage, $language=null) {
709+
if ($language !== null) {
710+
$multiLingualMessage = \json_decode(
711+
\file_get_contents("./tests/acceptance/multiLanguageErrors.json"),
712+
true
713+
);
714+
715+
if (isset($multiLingualMessage[$statusMessage][$language])) {
716+
$statusMessage = $multiLingualMessage[$statusMessage][$language];
717+
}
718+
}
719+
707720
Assert::assertEquals(
708721
$statusMessage,
709722
$this->getOCSResponseStatusMessage(
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"Wrong share ID, share doesn't exist": {
3+
"de-DE": "Fehlerhafte Freigabe-ID, Freigabe existiert nicht",
4+
"zh-CN": "错误的共享 ID,共享不存在",
5+
"fr-FR": "Mauvais ID de partage, le partage n'existe pas",
6+
"es-ES": "El ID del recurso compartido no es correcto, el recurso compartido no existe"
7+
}
8+
}

0 commit comments

Comments
 (0)