\Tests\FeatureMailServiceTest

邮件发送链路

被测对象:MailService(sendRegisterCode / sendResetPassword) 守护约定:注册验证码邮件内置默认模板回退 + 场景绑定自定义模板;找回密码邮件正常发送; sendByScene 是注册/找回密码两链路的唯一发送入口。

Summary

Methods
Properties
Constants
test_send_register_code_falls_back_to_builtin_template()
test_send_register_code_uses_bound_custom_template()
test_send_reset_password_sends_email()
No public properties found
No constants found
requireRedis()
buildCacheRegistry()
setUp()
tearDown()
No protected properties found
N/A
assertSentTo()
$boundCode
N/A

Properties

$boundCode

$boundCode : string

场景绑定码(mail.scene.register 配置值);空 = 回退内置默认模板

Type

string

Methods

test_send_register_code_falls_back_to_builtin_template()

test_send_register_code_falls_back_to_builtin_template() : void

验证模板表为空时回退内置默认模板发送注册验证码。

test_send_register_code_uses_bound_custom_template()

test_send_register_code_uses_bound_custom_template() : void

验证场景绑定自定义模板时优先使用绑定模板发送注册验证码。

test_send_reset_password_sends_email()

test_send_reset_password_sends_email() : void

验证找回密码邮件正常发送并渲染重置链接。

requireRedis()

requireRedis() : void

Redis 依赖探针:直连 Redis 的测试(限流/会话/验证码)在无 Redis 环境(如 CI) 跳过而非失败——其余用例不受影响。CI 可设 TEST_REQUIRE_REDIS=1 强制模式: Redis 不可达即失败而非跳过,安全回归套件不允许静默消失。

buildCacheRegistry()

buildCacheRegistry(array  $items) : void

建缓存注册表最小 schema(td_sys_cache)并灌入注册项。

测试跑 sqlite :memory:,生产迁移含 PostgreSQL 专属 DDL 跑不通(DataScopeServiceTest 同因自建 schema); 而 CacheManager::registry() 现已从数据库表读取——凡走注册表的测试(remember/get/key/失效推导) 必须在 setUp 先调用本方法,否则注册表为空、remember 未登记名会走「自动登记」路径。

Parameters

array $items

setUp()

setUp() : void

tearDown()

tearDown() : void

assertSentTo()

assertSentTo(string  $to, string  $fragment) : void

断言恰有一封发往目标邮箱、正文含关键片段的邮件

Parameters

string $to
string $fragment