forked from kaliop-uk/ezmigrationbundle
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add test for mail sending; improve param resoving for reference/set s…
…teps
- Loading branch information
gggeek
committed
Jul 30, 2017
1 parent
975ea79
commit 675380f
Showing
11 changed files
with
123 additions
and
4 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
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,83 @@ | ||
- | ||
type: reference | ||
mode: set | ||
identifier: kmb_test_023_subject | ||
value: testing | ||
|
||
- | ||
type: reference | ||
mode: set | ||
identifier: kmb_test_023_body | ||
value: migrations | ||
|
||
- | ||
type: mail | ||
mode: send | ||
from: test@test.me | ||
to: test@test.you | ||
cc: test@test.him | ||
bcc: | ||
- test@test.her | ||
- test@test.they | ||
subject: "this is an email subject about [reference:kmb_test_023_subject] etc..." | ||
body: "this is an email body about [reference:kmb_test_023_body] etc..." | ||
attach: files/emptyfile.txt | ||
|
||
# NB: this file is made available by a custom swiftmailer listener | ||
- | ||
type: file | ||
mode: load | ||
file: /tmp/mail.txt | ||
references: | ||
- | ||
attribute: body | ||
identifier: kmb_test_023_mailmessage | ||
|
||
- | ||
type: assert | ||
target: reference | ||
identifier: reference:kmb_test_023_mailmessage | ||
test: | ||
contains: "From: test@test.me" | ||
|
||
- | ||
type: assert | ||
target: reference | ||
identifier: reference:kmb_test_023_mailmessage | ||
test: | ||
contains: "To: test@test.you" | ||
|
||
- | ||
type: assert | ||
target: reference | ||
identifier: reference:kmb_test_023_mailmessage | ||
test: | ||
contains: "Cc: test@test.him" | ||
|
||
- | ||
type: assert | ||
target: reference | ||
identifier: reference:kmb_test_023_mailmessage | ||
test: | ||
contains: "Bcc: test@test.her, test@test.they" | ||
|
||
- | ||
type: assert | ||
target: reference | ||
identifier: reference:kmb_test_023_mailmessage | ||
test: | ||
contains: "Content-Type: multipart/mixed;" | ||
|
||
- | ||
type: assert | ||
target: reference | ||
identifier: reference:kmb_test_023_mailmessage | ||
test: | ||
contains: "this is an email body about migrations etc..." | ||
|
||
- | ||
type: assert | ||
target: reference | ||
identifier: reference:kmb_test_023_mailmessage | ||
test: | ||
contains: "Subject: this is an email subject about testing etc..." |
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
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,19 @@ | ||
<?php | ||
|
||
namespace Kaliop\eZMigrationBundle\Tests\helper; | ||
|
||
use Swift_Plugins_MessageLogger; | ||
use Swift_Events_SendEvent; | ||
|
||
class MailMessageLogger extends Swift_Plugins_MessageLogger | ||
{ | ||
/** | ||
* @todo make the name of the written file configurable, and/or do set references to it on saving | ||
* @param Swift_Events_SendEvent $evt | ||
*/ | ||
public function sendPerformed(Swift_Events_SendEvent $evt) | ||
{ | ||
$msg = $evt->getMessage(); | ||
file_put_contents('/tmp/mail.txt', $msg->toString()); | ||
} | ||
} |
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