test(email): 更新了邮件发送的测试账号

This commit is contained in:
李东云
2023-02-27 11:05:13 +08:00
parent a7a8087509
commit 8dcf586baf
2 changed files with 22 additions and 14 deletions

View File

@@ -57,7 +57,11 @@
"hyperf/session": "Session 鉴权必需",
"symfony/mailer": "用于发送电子邮件",
"guzzlehttp/guzzle": "需要发起 http 请求时必需",
"alibabacloud/dysmsapi-20170525": "阿里云短信服务必需"
"alibabacloud/dysmsapi-20170525": "阿里云短信服务必需",
"laminas/laminas-text": "用于cli展示表格和大字",
"gevman/interactive-cli": "用于提供漂亮的交互式命令行",
"clue/stdio-react": "一个基于 reactphp 的交互式命令行",
"brainmaestro/composer-git-hooks": "用于 php 项目的 git-hooks"
},
"config": {
"optimize-autoloader": true,

View File

@@ -12,25 +12,27 @@ namespace Singularity\HDK\Test\Core\Service;
use Singularity\HDK\Core\Service\EmailService;
use Symfony\Component\Mailer\Exception\TransportException;
$dsn = 'smtp://account@luxcreo.ai:Qfsd8866@smtp.qiye.aliyun.com:465';
$dsn = 'smtp://account@luxcreo.com:Qfsd8866@smtp-mail.outlook.com:587';
$mail_sender_name = 'LuxCreo';
$mail_sender = 'account@luxcreo.ai';
$mail_sender = 'account@luxcreo.com';
$email = new EmailService($dsn, $mail_sender_name, $mail_sender);
it('assertions that send HTML is available', function () use ($email) {
$result = $email->sendHtml(
'dongyun.li@luxcreo.ai',
'HDK Unit Test HTML',
<<<HTML
$target = 'dongyun.li@luxcreo.ai';
it('assertions that send HTML is available', function () use ($email, $target) {
$result = $email->sendHtml(
$target,
'HDK Unit Test HTML',
<<<HTML
<h1>Hello, World!</h1>
HTML
);
expect($result)->toBeTrue();
);
expect($result)->toBeTrue();
});
it('assertions that send Text is available', function () use ($email) {
it('assertions that send Text is available', function () use ($email, $target) {
$result = $email->sendText(
'dongyun.li@luxcreo.ai',
$target,
'HDK Unit Test Text',
<<<Text
<h1>Hello, World!</h1>
@@ -41,24 +43,26 @@ Text
it('assertions Error Receiver can be catch', function () use ($email) {
try {
$email->sendHtml(
$result = $email->sendHtml(
'unknown@luxcreo.ai',
'HDK Unit Test',
<<<HTML
<h1>Hello, World!</h1>
HTML
);
expect($result)->toBeTrue();
} catch (TransportException $t) {
expect($t->getCode())->toBe(554);
}
try {
$email->sendText(
$result = $email->sendText(
'unknown@luxcreo.ai',
'HDK Unit Test',
<<<Text
<h1>Hello, World!</h1>
Text
);
expect($result)->toBeTrue();
} catch (TransportException $t) {
expect($t->getCode())->toBe(554);
}