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

Commit ec6fbe2

Browse files
committed
Add test for ignore tags
1 parent 4d1627a commit ec6fbe2

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

src/DeepL.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ class DeepL
107107
*
108108
* @var array
109109
*/
110-
protected $ignoreTags = [];
110+
protected $ignoreTags = array();
111111

112112
/**
113113
* DeepL constructor

tests/DeepLTest.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,26 @@ public function testTranslateTagHandlingSuccess()
153153
$this->assertEquals('<strong>Text zu übersetzen</strong>', $translatedText);
154154
}
155155

156+
/**
157+
* Test translate() with tag ignored success
158+
*
159+
* TEST REQUIRES VALID DEEPL AUTH KEY!!
160+
*/
161+
public function testTranslateIgnoreTagsSuccess()
162+
{
163+
return;
164+
165+
$authKey = 'INSERT YOUR AUTH KEY HERE';
166+
$englishText = '<strong>text to do not translate</strong><p>text to translate</p>';
167+
168+
$deepl = new DeepL($authKey);
169+
170+
$deepl->setIgnoreTags(array('strong'));
171+
$translatedText = $deepl->translate($germanText, 'en', 'de', array('xml'));
172+
173+
$this->assertEquals('<strong>text to do not translate</strong><p>Text zu übersetzen</p>', $translatedText);
174+
}
175+
156176
/**
157177
* Test translate()
158178
*

0 commit comments

Comments
 (0)