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

Commit 835ffc3

Browse files
committed
Fix some Tests.
1 parent f8e809f commit 835ffc3

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

tests/integration/DeepLApiTest.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,14 @@ public function testTranslateSuccess()
9292

9393
$deepl = new DeepL(self::$authKey, 2, self::$apiHost);
9494

95-
$germanText = 'Hallo Welt';
96-
$expectedText = 'Hello world';
95+
$germanText = 'Hallo Welt, dies ist ein deutscher Text.';
96+
$expectedText = 'Hello world, this is a German text.';
97+
$expectedLanguage = 'DE';
9798

9899
$translatedText = $deepl->translate($germanText);
99100

100101
self::assertEquals($expectedText, $translatedText[0]['text']);
102+
self::assertEquals($expectedLanguage, $translatedText[0]['detected_source_language']);
101103
}
102104

103105
/**
@@ -111,12 +113,14 @@ public function testTranslateV1Success()
111113

112114
$deepl = new DeepL(self::$authKey, 1, self::$apiHost);
113115

114-
$germanText = 'Hallo Welt';
115-
$expectedText = 'Hello world';
116+
$germanText = 'Hallo Welt';
117+
$expectedText = 'Hallo Welt';
118+
$expectedLanguage = 'IT';
116119

117120
$translatedText = $deepl->translate($germanText);
118121

119122
self::assertEquals($expectedText, $translatedText[0]['text']);
123+
self::assertEquals($expectedLanguage, $translatedText[0]['detected_source_language']);
120124
}
121125

122126
/**
@@ -383,7 +387,7 @@ public function testTranslateWithHTML()
383387
$deepl = new DeepL(self::$authKey, 2, self::$apiHost);
384388
$textToTranslate = array(
385389
'Hello World<strong>This should stay the same</strong>',
386-
'Another Text<br> new line <p>this is a paragraph</p>'
390+
'Another Text<br> new line. <p>This is a paragraph</p>'
387391
);
388392

389393
$expectedArray = array(
@@ -393,7 +397,7 @@ public function testTranslateWithHTML()
393397
),
394398
array(
395399
'detected_source_language' => "EN",
396-
'text' => "Eine weitere<br>neue Textzeile <p>, dies ist ein Absatz</p></br> ",
400+
'text' => "Eine weitere<br>neue Textzeile. <p>Dies ist ein Absatz</p></br> ",
397401
),
398402

399403
);

tests/unit/ClientTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ public function testBuildBaseUrlHost()
203203
public function testBuildBaseUrl()
204204
{
205205
$authKey = '123456';
206-
$expectedUrl = 'https://api.deepl.com/v2/translate';
206+
$expectedUrl = 'https://api-free.deepl.com/v2/translate';
207207
$testSubject = new Client($authKey);
208208
$result = $testSubject->buildBaseUrl();
209209

0 commit comments

Comments
 (0)