@@ -705,12 +705,16 @@ public function theOcsStatusCodeShouldBeOr($statusCode1, $statusCode2) {
705
705
* Check the text in an OCS status message
706
706
*
707
707
* @Then /^the OCS status message should be "([^"]*)"$/
708
+ * @Then /^the OCS status message should be "([^"]*)" in language "([^"]*)"$/
708
709
*
709
710
* @param string $statusMessage
711
+ * @param string $language
710
712
*
711
713
* @return void
712
714
*/
713
- public function theOCSStatusMessageShouldBe ($ statusMessage ) {
715
+ public function theOCSStatusMessageShouldBe ($ statusMessage , $ language =null ) {
716
+ $ statusMessage = $ this ->getActualStatusMessage ($ statusMessage , $ language );
717
+
714
718
Assert::assertEquals (
715
719
$ statusMessage ,
716
720
$ this ->getOCSResponseStatusMessage (
@@ -811,6 +815,28 @@ public function getOCSResponseStatusMessage($response) {
811
815
return (string ) $ this ->featureContext ->getResponseXml ($ response , __METHOD__ )->meta [0 ]->message ;
812
816
}
813
817
818
+ /**
819
+ * convert status message in the desired language
820
+ *
821
+ * @param $statusMessage
822
+ * @param $language
823
+ *
824
+ * @return string
825
+ */
826
+ public function getActualStatusMessage ($ statusMessage , $ language ) {
827
+ if ($ language !== null ) {
828
+ $ multiLingualMessage = \json_decode (
829
+ \file_get_contents ("./tests/acceptance/fixtures/multiLanguageErrors.json " ),
830
+ true
831
+ );
832
+
833
+ if (isset ($ multiLingualMessage [$ statusMessage ][$ language ])) {
834
+ $ statusMessage = $ multiLingualMessage [$ statusMessage ][$ language ];
835
+ }
836
+ }
837
+ return $ statusMessage ;
838
+ }
839
+
814
840
/**
815
841
* check if the HTTP status code and the OCS status code indicate that the request was successful
816
842
* this function is aware of the currently used OCS version
0 commit comments