forked from PHPMailer/PHPMailer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tests: introduce dedicated tests for text localization
So far, the methods related to text localization - `PHPMailer::setLanguage()`, `PHPMailer::getTranslations()` and `PHPMailer::lang()` - did not have dedicated tests. The test file this commit introduces, tests all aspects of these methods, including the changes introduced in response to 2418 and 2419, as well as documents the current behaviour of the methods for specific, outlier situations.
- Loading branch information
Showing
12 changed files
with
601 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
/** | ||
* Test fixture. | ||
* | ||
* Used in the `PHPMailer\LocalizationTest` to test overruling an existing translation | ||
* file with a custom one by passing in a `$langPath` parameter. | ||
*/ | ||
|
||
$PHPMAILER_LANG['empty_message'] = "Custom path test success (fr)"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
/** | ||
* Test fixture. | ||
* | ||
* Used in the `PHPMailer\LocalizationTest` to test overruling an existing translation | ||
* file with a custom one by passing in a `$langPath` parameter. | ||
*/ | ||
|
||
$PHPMAILER_LANG['empty_message'] = 'Custom path test success (nl)'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
/** | ||
* Test fixture. | ||
* | ||
* Used in the `PHPMailer\LocalizationTest` to test the fall-back logic. | ||
*/ | ||
|
||
$PHPMAILER_LANG['empty_message'] = 'XA Lang-script-country file found'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
/** | ||
* Test fixture. | ||
* | ||
* Used in the `PHPMailer\LocalizationTest` to test the fall-back logic. | ||
*/ | ||
|
||
$PHPMAILER_LANG['empty_message'] = 'XB Lang-script file found'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
/** | ||
* Test fixture. | ||
* | ||
* Used in the `PHPMailer\LocalizationTest` to test the fall-back logic. | ||
*/ | ||
|
||
$PHPMAILER_LANG['empty_message'] = 'XC Lang-country file found'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
/** | ||
* Test fixture. | ||
* | ||
* Used in the `PHPMailer\LocalizationTest` to test the fall-back logic. | ||
*/ | ||
|
||
$PHPMAILER_LANG['empty_message'] = 'XD Lang-country file found'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
/** | ||
* Test fixture. | ||
* | ||
* Used in the `PHPMailer\LocalizationTest` to test the fall-back logic. | ||
*/ | ||
|
||
$PHPMAILER_LANG['empty_message'] = 'XD Lang-script file found'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
/** | ||
* Test fixture. | ||
* | ||
* Used in the `PHPMailer\LocalizationTest` to test the fall-back logic. | ||
*/ | ||
|
||
$PHPMAILER_LANG['empty_message'] = 'XE Lang file found'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
/** | ||
* Test fixture. | ||
* | ||
* Used in the `PHPMailer\LocalizationTest`. | ||
*/ | ||
|
||
$PHPMAILER_LANG['empty_message'] = 'This file should not be loaded as the path is passed incorrectly'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
|
||
/** | ||
* Test fixture. | ||
* | ||
* Used in the `PHPMailer\LocalizationTest` to test that arbitrary code in translation files is disregarded. | ||
*/ | ||
|
||
$composer = file_get_contents(__DIR__ . '/../../../composer.json'); | ||
|
||
echo $composer; | ||
|
||
$PHPMAILER_LANG['extension_missing'] = 'Confirming that test fixture was loaded correctly (yy).'; | ||
$PHPMAILER_LANG['empty_message'] = $composer; | ||
$PHPMAILER_LANG['encoding'] = `ls -l`; | ||
$PHPMAILER_LANG['execute'] = exec('some harmful command'); | ||
$PHPMAILER_LANG['signing'] = "Double quoted but not interpolated $composer"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
/** | ||
* Test fixture. | ||
* | ||
* Used in the `PHPMailer\LocalizationTest` to test that language strings not | ||
* set via a fixed, known group of array index keys are disregarded. | ||
*/ | ||
|
||
$PHPMAILER_LANG['extension_missing'] = 'Confirming that test fixture was loaded correctly (zz).'; | ||
|
||
// Keys not in the original array. | ||
$PHPMAILER_LANG['unknown'] = 'Unknown text.'; | ||
$PHPMAILER_LANG['invalid'] = 'Invalid text.'; | ||
|
||
// Keys which exist in the original array, but use the wrong letter case or space instead of underscore. | ||
$PHPMAILER_LANG['Authenticate'] = 'Overruled text, index not same case'; | ||
$PHPMAILER_LANG['CONNECT_HOST'] = 'Overruled text, index not same case'; | ||
$PHPMAILER_LANG['Data_Not_Accepted'] = 'Overruled text, index not same case'; | ||
$PHPMAILER_LANG['empty message'] = 'Overruled text, index not same case'; |
Oops, something went wrong.