Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 049b850

Browse files
committed
- add Testcase for unsupported Languages
1 parent c22f16b commit 049b850

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

tests/integration/DeepLApiTest.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,4 +317,34 @@ public function testTranslateWithHTML()
317317

318318
$this->assertEquals($expectedArray, $translatedText);
319319
}
320+
321+
/**
322+
* Test translate() with unsupported sourceLanguage
323+
*/
324+
public function testTranslateWithNotSupportedSourceLanguage()
325+
{
326+
if (self::$authKey === false) {
327+
$this->markTestSkipped('DeepL Auth Key (DEEPL_AUTH_KEY) is not configured.');
328+
}
329+
330+
$deepl = new DeepL(self::$authKey);
331+
332+
$this->setExpectedException('\BabyMarkt\DeepL\DeepLException');
333+
$deepl->translate('some txt', 'dk', 'de');
334+
}
335+
336+
/**
337+
* Test translate() with unsupported sourceLanguage
338+
*/
339+
public function testTranslateWithNotSupportedDestinationLanguage()
340+
{
341+
if (self::$authKey === false) {
342+
$this->markTestSkipped('DeepL Auth Key (DEEPL_AUTH_KEY) is not configured.');
343+
}
344+
345+
$deepl = new DeepL(self::$authKey);
346+
347+
$this->setExpectedException('\BabyMarkt\DeepL\DeepLException');
348+
$deepl->translate('some txt', 'en', 'dk');
349+
}
320350
}

0 commit comments

Comments
 (0)