-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
putenv/getenv is not thread safe: https://jolicode.com/blog/what-you-need-to-know-about-environment-variables-with-php#thread-safety-of-getenv
- Loading branch information
Showing
2 changed files
with
20 additions
and
20 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
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 |
---|---|---|
|
@@ -8,6 +8,7 @@ | |
use PHPUnit\Framework\TestCase; | ||
use PopArtDesign\WordPressMailerDSN\PHPMailerConfigurator; | ||
|
||
|
||
/** | ||
* @covers PHPMailerConfigurator | ||
* @runTestsInSeparateProcesses | ||
|
@@ -20,7 +21,7 @@ public function testConfiguresUsingMailerDsnEnv() | |
$configurator = new PHPMailerConfigurator(); | ||
$mailer = new PHPMailer(); | ||
|
||
putenv('MAILER_DSN=smtps://pop:[email protected]:587?SMTPDebug=3&Timeout=1000'); | ||
$_ENV['MAILER_DSN'] = 'smtps://pop:[email protected]:587?SMTPDebug=3&Timeout=1000'; | ||
|
||
$configurator->configure($mailer); | ||
|
||
|
@@ -51,7 +52,7 @@ public function testGivesPreferenceToEnvsOverConstants() | |
$configurator = new PHPMailerConfigurator(); | ||
$mailer = new PHPMailer(); | ||
|
||
putenv('MAILER_DSN=smtps://pop:[email protected]:587?SMTPDebug=3&Timeout=1000'); | ||
$_ENV['MAILER_DSN'] = 'smtps://pop:[email protected]:587?SMTPDebug=3&Timeout=1000'; | ||
define('MAILER_DSN', 'sendmail://localhost?Sendmail=/usr/sbin/sendmail%20-oi%20-t'); | ||
|
||
$configurator->configure($mailer); | ||
|
@@ -64,8 +65,8 @@ public function testConfiguresDebugUsingEnvs() | |
$configurator = new PHPMailerConfigurator(); | ||
$mailer = new PHPMailer(); | ||
|
||
putenv('MAILER_DEBUG=3'); | ||
putenv('MAILER_DEBUG_OUTPUT=error_log'); | ||
$_ENV['MAILER_DEBUG'] = 3; | ||
$_ENV['MAILER_DEBUG_OUTPUT'] = 'error_log'; | ||
|
||
$configurator->configure($mailer); | ||
|
||
|
@@ -78,9 +79,9 @@ public function testConfiguresCommonUsingEnvs() | |
$configurator = new PHPMailerConfigurator(); | ||
$mailer = new PHPMailer(); | ||
|
||
putenv('MAILER_FROM=[email protected]'); | ||
putenv('MAILER_FROM_NAME=Oleg Voronkovich'); | ||
putenv('MAILER_SENDER=[email protected]'); | ||
$_ENV['MAILER_FROM'] = '[email protected]'; | ||
$_ENV['MAILER_FROM_NAME'] = 'Oleg Voronkovich'; | ||
$_ENV['MAILER_SENDER'] = '[email protected]'; | ||
|
||
$configurator->configure($mailer); | ||
|
||
|
@@ -94,12 +95,12 @@ public function testConfiguresDkimUsingEnvs() | |
$configurator = new PHPMailerConfigurator(); | ||
$mailer = new PHPMailer(); | ||
|
||
putenv('MAILER_DKIM_PRIVATE=/tmp/private.key'); | ||
putenv('MAILER_DKIM_PRIVATE_STRING=private'); | ||
putenv('MAILER_DKIM_PASSPHRASE=secret'); | ||
putenv('MAILER_DKIM_SELECTOR=mailer'); | ||
putenv('MAILER_DKIM_DOMAIN=popartdesign.ru'); | ||
putenv('MAILER_DKIM_IDENTITY=[email protected]'); | ||
$_ENV['MAILER_DKIM_PRIVATE'] = '/tmp/private.key'; | ||
$_ENV['MAILER_DKIM_PRIVATE_STRING'] = 'private'; | ||
$_ENV['MAILER_DKIM_PASSPHRASE'] = 'secret'; | ||
$_ENV['MAILER_DKIM_SELECTOR'] = 'mailer'; | ||
$_ENV['MAILER_DKIM_DOMAIN'] = 'popartdesign.ru'; | ||
$_ENV['MAILER_DKIM_IDENTITY'] = '[email protected]'; | ||
|
||
$configurator->configure($mailer); | ||
|
||
|
@@ -118,10 +119,10 @@ public function testConfiguresDkimDomainAndIdentityWithDefaultValues() | |
|
||
$mailer->From = '[email protected]'; | ||
|
||
putenv('MAILER_DKIM_PRIVATE=/tmp/private.key'); | ||
putenv('MAILER_DKIM_PRIVATE_STRING=private'); | ||
putenv('MAILER_DKIM_PASSPHRASE=secret'); | ||
putenv('MAILER_DKIM_SELECTOR=mailer'); | ||
$_ENV['MAILER_DKIM_PRIVATE'] = '/tmp/private.key'; | ||
$_ENV['MAILER_DKIM_PRIVATE_STRING'] = 'private'; | ||
$_ENV['MAILER_DKIM_PASSPHRASE'] = 'secret'; | ||
$_ENV['MAILER_DKIM_SELECTOR'] = 'mailer'; | ||
|
||
$configurator->configure($mailer); | ||
|
||
|