-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33 from kuldeepkhichar/patch-1
Updated plugin to support replyTo
- Loading branch information
Showing
6 changed files
with
48 additions
and
9 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
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,8 @@ | ||
parameters: | ||
level: 7 | ||
checkMissingIterableValueType: false | ||
autoload_files: | ||
- tests/bootstrap.php | ||
ignoreErrors: | ||
- '#Parameter \#1 \$str of function trim expects string, array\|string given.#' | ||
- '#Result of \|\| is always true.#' |
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
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 |
---|---|---|
|
@@ -85,6 +85,7 @@ public function testAdditionalEmailAddresses() | |
->setTo('[email protected]') | ||
->addCC(['[email protected]', '[email protected]' => 'John']) | ||
->addBcc(['[email protected]', '[email protected]' => 'John']) | ||
->setReplyTo(['[email protected]' => 'John']) | ||
->setEmailFormat('both') | ||
->setSubject('Email from CakePHP Mailgun plugin') | ||
->send('Hello there, <br> This is an email from CakePHP Mailgun Email plugin.'); | ||
|
@@ -99,12 +100,35 @@ public function testAdditionalEmailAddresses() | |
$this->assertTextContains('Content-Disposition: form-data; name="to"', $reqDataString); | ||
$this->assertTextContains('Content-Disposition: form-data; name="cc"', $reqDataString); | ||
$this->assertTextContains('Content-Disposition: form-data; name="bcc"', $reqDataString); | ||
$this->assertTextContains('Content-Disposition: form-data; name="h:Reply-To"', $reqDataString); | ||
$this->assertTextContains('[email protected] <[email protected]>', $reqDataString); | ||
$this->assertTextContains('[email protected] <[email protected]>', $reqDataString); | ||
$this->assertTextContains('[email protected] <[email protected]>', $reqDataString); | ||
$this->assertTextContains('John <[email protected]>', $reqDataString); | ||
$this->assertTextContains('[email protected] <[email protected]>', $reqDataString); | ||
$this->assertTextContains('John <[email protected]>', $reqDataString); | ||
$this->assertTextContains('John <[email protected]>', $reqDataString); | ||
} | ||
|
||
public function testCustomHeaders() | ||
{ | ||
$this->_setEmailConfig(); | ||
$email = new Email(); | ||
$email->setProfile(['transport' => 'mailgun']); | ||
$res = $email->setFrom('[email protected]') | ||
->setTo('[email protected]') | ||
->setHeaders(['h:X-MyHeader' => 'YouGotIt']) | ||
->setSubject('Email from CakePHP Mailgun plugin') | ||
->send('Hello there, <br> This is an email from CakePHP Mailgun Email plugin.'); | ||
|
||
$reqData = $res['reqData']; | ||
$boundary = $reqData->boundary(); | ||
$reqDataString = (string)$reqData; | ||
|
||
$this->assertNotEmpty($reqDataString); | ||
$this->assertStringStartsWith("--$boundary", $reqDataString); | ||
$this->assertTextContains('Content-Disposition: form-data; name="h:X-MyHeader"', $reqDataString); | ||
$this->assertTextContains('YouGotIt', $reqDataString); | ||
} | ||
|
||
public function testAttachments() | ||
|
@@ -116,7 +140,7 @@ public function testAttachments() | |
->setTo('[email protected]') | ||
->setAttachments([ | ||
'logo.png' => ['file' => TESTS . DS . 'assets' . DS . 'logo.png', 'contentId' => 'logo.png'], | ||
'cake.power.gif' => ['file' => TESTS . DS . 'assets' . DS . 'cake.power.gif'] | ||
'cake.power.gif' => ['file' => TESTS . DS . 'assets' . DS . 'cake.power.gif'], | ||
]) | ||
->setSubject('Email from CakePHP Mailgun plugin') | ||
->send('Hello there, <br> This is an email from CakePHP Mailgun Email plugin.'); | ||
|