|
1
|
|
|
<?php |
|
2
|
|
|
namespace Da\Mailer\Test\Fixture; |
|
3
|
|
|
|
|
4
|
|
|
use Da\Mailer\Queue\Backend\Beanstalk\BeanstalkdMailJob; |
|
5
|
|
|
use Da\Mailer\Queue\Backend\Sqs\SqsMailJob; |
|
6
|
|
|
use Da\Mailer\Model\MailMessage; |
|
7
|
|
|
use Da\Mailer\Queue\Backend\Pdo\PdoMailJob; |
|
8
|
|
|
use Da\Mailer\Queue\Backend\Redis\RedisMailJob; |
|
9
|
|
|
use Da\Mailer\Transport\TransportInterface; |
|
10
|
|
|
|
|
11
|
|
|
class FixtureHelper |
|
12
|
|
|
{ |
|
13
|
|
|
public static function getMailMessage() |
|
14
|
|
|
{ |
|
15
|
|
|
return new MailMessage(self::getMailMessageSmtpConfigurationArray()); |
|
16
|
|
|
} |
|
17
|
|
|
|
|
18
|
|
|
public static function getPdoMailJob() |
|
19
|
|
|
{ |
|
20
|
|
|
return new PdoMailJob([ |
|
21
|
|
|
'message' => json_encode(self::getMailMessage()), |
|
22
|
|
|
'timeToSend' => date('Y-m-d H:i:s', time()) |
|
23
|
|
|
]); |
|
24
|
|
|
} |
|
25
|
|
|
|
|
26
|
|
|
public static function getRedisMailJob() |
|
27
|
|
|
{ |
|
28
|
|
|
return new RedisMailJob([ |
|
29
|
|
|
'message' => json_encode(self::getMailMessage()), |
|
30
|
|
|
]); |
|
31
|
|
|
} |
|
32
|
|
|
|
|
33
|
|
|
public static function getBeanstalkdMailJob() |
|
34
|
|
|
{ |
|
35
|
|
|
return new BeanstalkdMailJob([ |
|
36
|
|
|
'message' => json_encode(self::getMailMessage()), |
|
37
|
|
|
]); |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
public static function getSqsMailJob() |
|
41
|
|
|
{ |
|
42
|
|
|
return new SqsMailJob([ |
|
43
|
|
|
'message' => json_encode(self::getMailMessage()) |
|
44
|
|
|
]); |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
public static function getMySqlConnectionConfiguration() |
|
48
|
|
|
{ |
|
49
|
|
|
return [ |
|
50
|
|
|
'connectionString' => 'mysql:host=127.0.0.1;dbname=mail_queue_test', |
|
51
|
|
|
'username' => 'root', |
|
52
|
|
|
'password' => '', |
|
53
|
|
|
]; |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
public static function getMailMessageSmtpConfigurationArray() |
|
57
|
|
|
{ |
|
58
|
|
|
return [ |
|
59
|
|
|
'transportOptions' => [], |
|
60
|
|
|
'transportType' => TransportInterface::TYPE_SMTP, |
|
61
|
|
|
'host' => '127.0.0.1', |
|
62
|
|
|
'port' => 21, |
|
63
|
|
|
'from' => '[email protected]', |
|
64
|
|
|
'to' => '[email protected]', |
|
65
|
|
|
'cc' => '[email protected]', |
|
66
|
|
|
'bcc' => '[email protected]', |
|
67
|
|
|
'subject' => 'subject', |
|
68
|
|
|
'bodyHtml' => '<b>This is body Html</b>', |
|
69
|
|
|
'bodyText' => 'This is body text', |
|
70
|
|
|
'attachments' => [__DIR__ . '/../data/test_view.php'], |
|
71
|
|
|
]; |
|
72
|
|
|
} |
|
73
|
|
|
} |
|
74
|
|
|
|