This repository was archived by the owner on Apr 12, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +46
-0
lines changed Expand file tree Collapse file tree 1 file changed +46
-0
lines changed Original file line number Diff line number Diff line change @@ -273,4 +273,50 @@ public function testTranslateFormalityFail()
273
273
'more ' //$formality
274
274
);
275
275
}
276
+
277
+
278
+ /**
279
+ * Test to Test the Tag-Handling.
280
+ */
281
+ public function testTranslateWithHTML ()
282
+ {
283
+ if (self ::$ authKey === false ) {
284
+ $ this ->markTestSkipped ('DeepL Auth Key (DEEPL_AUTH_KEY) is not configured. ' );
285
+ }
286
+
287
+ $ deepl = new DeepL (self ::$ authKey );
288
+ $ textToTranslate = array (
289
+ 'Hello World<strong>This should stay the same</strong> ' ,
290
+ 'Another Text<br> new line <p>this is a paragraph</p> '
291
+ );
292
+
293
+ $ expectedArray = array (
294
+ array (
295
+ 'detected_source_language ' => "EN " ,
296
+ 'text ' => "Hallo Welt<strong>This should stay the same</strong> " ,
297
+ ),
298
+ array (
299
+ 'detected_source_language ' => "EN " ,
300
+ 'text ' => "Ein weiterer Text neue Zeile <p>dies ist ein Absatz</p> " ,
301
+ ),
302
+
303
+ );
304
+
305
+ $ translatedText = $ deepl ->translate (
306
+ $ textToTranslate ,
307
+ 'en ' , //$sourceLanguage
308
+ 'de ' , //$destinationLanguage
309
+ 'xml ' , //$tagHandling
310
+ array ('strong ' ), //$ignoreTags
311
+ 'less ' , //$formality
312
+ 'translate ' ,
313
+ 1 ,
314
+ 0 ,
315
+ array ('br ' ),
316
+ 1 ,
317
+ array ('p ' )
318
+ );
319
+
320
+ $ this ->assertEquals ($ expectedArray , $ translatedText );
321
+ }
276
322
}
You can’t perform that action at this time.
0 commit comments