\Tests\UnitSmsServiceTest

短信发送框架

被测对象:SmsService(dummy 链路,走 send() 纯逻辑不碰 DB) 守护约定:未配置通道提示未发送;dummy 通道签名拼接 + Log 记录;渲染缺参拒发; 真实服务商 HTTP 驱动按签名模式构造请求;ConfigService 以 Mockery mock。

Summary

Methods
Properties
Constants
test_unconfigured_channel_returns_not_sent()
test_dummy_channel_sends_and_appends_signature()
test_render_missing_var_rejects_and_propagates_exception()
test_aliyun_rpc_sign_mode_appends_signature_params()
test_tencent_tc3_sign_mode_appends_signature_headers()
test_basic_sign_mode_appends_auth_header()
test_http_driver_builds_request_by_param_template()
test_http_driver_non_2xx_throws()
test_first_keyless_channel_skipped_uses_second()
No public properties found
No constants found
setUp()
No protected properties found
N/A
template()
$helper
$config
N/A

Properties

$helper

$helper : \App\Services\Admin\SmsService

Type

SmsService

$config

$config : \App\Services\Admin\ConfigService

Type

ConfigService

Methods

test_unconfigured_channel_returns_not_sent()

test_unconfigured_channel_returns_not_sent() : mixed

验证未配置通道时返回未发送提示。

Returns

mixed —

test_dummy_channel_sends_and_appends_signature()

test_dummy_channel_sends_and_appends_signature() : mixed

验证 dummy 通道发送成功且签名自动拼接并记录日志。

Returns

mixed —

test_render_missing_var_rejects_and_propagates_exception()

test_render_missing_var_rejects_and_propagates_exception() : mixed

验证渲染缺参时透传渲染器异常拒发。

Returns

mixed —

test_aliyun_rpc_sign_mode_appends_signature_params()

test_aliyun_rpc_sign_mode_appends_signature_params() : mixed

验证阿里云 RPC 签名模式自动附加签名参数。

Returns

mixed —

test_tencent_tc3_sign_mode_appends_signature_headers()

test_tencent_tc3_sign_mode_appends_signature_headers() : mixed

验证腾讯 TC3 签名模式自动附加签名头。

Returns

mixed —

test_basic_sign_mode_appends_auth_header()

test_basic_sign_mode_appends_auth_header() : mixed

验证 basic 签名模式附加 Basic 认证头。

Returns

mixed —

test_http_driver_builds_request_by_param_template()

test_http_driver_builds_request_by_param_template() : mixed

验证通用 HTTP 驱动按参数模板构造请求并发送。

Returns

mixed —

test_http_driver_non_2xx_throws()

test_http_driver_non_2xx_throws() : mixed

验证通用 HTTP 驱动非 2xx 响应抛异常。

Returns

mixed —

test_first_keyless_channel_skipped_uses_second()

test_first_keyless_channel_skipped_uses_second() : mixed

验证首个无密钥通道被跳过、取用第二个可用通道。

Returns

mixed —

setUp()

setUp() : void

template()

template(string  $content = '您的验证码为 {{code}},5 分钟内有效', array  $vars = []) : \App\Models\SysTemplate

Parameters

string $content
array $vars

Returns

\App\Models\SysTemplate —