Skip to content

Commit

Permalink
Add test to check for missing translations (will often spot corrupt o…
Browse files Browse the repository at this point in the history
…nes too)
  • Loading branch information
Synchro committed Nov 20, 2008
1 parent e570ea0 commit c472d9a
Showing 1 changed file with 35 additions and 2 deletions.
37 changes: 35 additions & 2 deletions test/phpmailer_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -531,8 +531,41 @@ function test_Addressing() {
$this->assert(!$this->Mail->AddBCC('c@example.com'), 'BCC duplicate addressing failed');
$this->assert(!$this->Mail->AddBCC('a@example.com'), 'BCC duplicate Addressing failed (2)');
}
}


// Check that we are not missing any translations in any langauges
function test_Translations() {
//Extend this array as new strings are added
$expectedtranslations = array(
'provide_address',
'mailer_not_supported',
'execute',
'instantiate',
'authenticate',
'from_failed',
'recipients_failed',
'data_not_accepted',
'connect_host',
'file_access',
'file_open',
'encoding',
'signing',
'smtp_error'
);
try {
foreach (new DirectoryIterator('../language') as $langfile) {
if (!preg_match('/^phpmailer\.lang-/', $langfile)) continue; //Skip non-language files
$PHPMAILER_LANG = array();
include '../language/'.$langfile;
foreach($expectedtranslations as $string) {
$this->assert(isset($PHPMAILER_LANG[$string]), 'Translation missing; \''.$string.'\' in '.$langfile);
}
}
}
catch(Exception $e) {
$this->assert(false, 'No language files found!');
}
}
}
/**
* Create and run test instance.
*/
Expand Down

0 comments on commit c472d9a

Please sign in to comment.