Definition at line 17 of file SwiftMailerHandlerTest.php.
◆ setUp()
Monolog\Handler\SwiftMailerHandlerTest::setUp |
( |
| ) |
|
◆ testMessageCanBeCustomizedGivenLoggedData()
Monolog\Handler\SwiftMailerHandlerTest::testMessageCanBeCustomizedGivenLoggedData |
( |
| ) |
|
Definition at line 47 of file SwiftMailerHandlerTest.php.
References $records, array, Monolog\Logger\EMERGENCY, and Monolog\TestCase\getRecord().
50 $expectedMessage = new \Swift_Message();
51 $this->mailer->expects($this->once())
53 ->with($this->callback(
function ($value) use ($expectedMessage) {
54 return $value instanceof \Swift_Message
55 && $value->getSubject() ===
'Emergency' 56 && $value === $expectedMessage;
60 $callback =
function ($content,
array $records) use ($expectedMessage) {
61 $subject = count(
$records) > 0 ?
'Emergency' :
'Normal';
62 $expectedMessage->setSubject($subject);
64 return $expectedMessage;
66 $handler =
new SwiftMailerHandler($this->mailer, $callback);
getRecord($level=Logger::WARNING, $message='test', $context=array())
const EMERGENCY
Urgent alert.
Create styles array
The data for the language used.
◆ testMessageCreationIsLazyWhenUsingCallback()
Monolog\Handler\SwiftMailerHandlerTest::testMessageCreationIsLazyWhenUsingCallback |
( |
| ) |
|
Definition at line 30 of file SwiftMailerHandlerTest.php.
References $records, array, Monolog\Logger\DEBUG, Monolog\TestCase\getRecord(), and Monolog\Logger\INFO.
32 $this->mailer->expects($this->never())
35 $callback =
function () {
36 throw new \RuntimeException(
'Swift_Message creation callback should not have been called in this test');
38 $handler =
new SwiftMailerHandler($this->mailer, $callback);
const DEBUG
Detailed debug information.
getRecord($level=Logger::WARNING, $message='test', $context=array())
Create styles array
The data for the language used.
const INFO
Interesting events.
◆ testMessageHaveUniqueId()
Monolog\Handler\SwiftMailerHandlerTest::testMessageHaveUniqueId |
( |
| ) |
|
Definition at line 99 of file SwiftMailerHandlerTest.php.
References array.
101 $messageTemplate = \Swift_Message::newInstance();
102 $handler =
new SwiftMailerHandler($this->mailer, $messageTemplate);
104 $method = new \ReflectionMethod(
'Monolog\Handler\SwiftMailerHandler',
'buildMessage');
105 $method->setAccessible(
true);
106 $method->invokeArgs($handler,
array($messageTemplate,
array()));
108 $builtMessage1 = $method->invoke($handler, $messageTemplate,
array());
109 $builtMessage2 = $method->invoke($handler, $messageTemplate,
array());
111 $this->assertFalse($builtMessage1->getId() === $builtMessage2->getId(),
'Two different messages have the same id');
Create styles array
The data for the language used.
◆ testMessageSubjectFormatting()
Monolog\Handler\SwiftMailerHandlerTest::testMessageSubjectFormatting |
( |
| ) |
|
Definition at line 75 of file SwiftMailerHandlerTest.php.
References $records, array, Monolog\Logger\EMERGENCY, and Monolog\TestCase\getRecord().
78 $messageTemplate = new \Swift_Message();
79 $messageTemplate->setSubject(
'Alert: %level_name% %message%');
80 $receivedMessage = null;
82 $this->mailer->expects($this->once())
84 ->with($this->callback(
function ($value) use (&$receivedMessage) {
85 $receivedMessage = $value;
89 $handler =
new SwiftMailerHandler($this->mailer, $messageTemplate);
96 $this->assertEquals(
'Alert: EMERGENCY test', $receivedMessage->getSubject());
getRecord($level=Logger::WARNING, $message='test', $context=array())
const EMERGENCY
Urgent alert.
Create styles array
The data for the language used.
◆ $mailer
Monolog\Handler\SwiftMailerHandlerTest::$mailer |
|
private |
The documentation for this class was generated from the following file: