\Tests\FeatureJobCenterDispatchTest

测试基座(抽象基类)

被测对象:无(公共测试设施) 守护约定:Redis 直连用例在无 Redis 环境(如 CI)跳过而非失败(TEST_REQUIRE_REDIS=1 可强制失败); 缓存注册表最小 schema 供 sqlite :memory: 下凡走注册表的用例自建。

Summary

Methods
Properties
Constants
test_push_creates_pending_ledger_with_payload_snapshot()
test_push_rejects_unregistered_type()
test_push_rejects_disabled_type()
test_push_rejects_missing_required_field()
test_push_rejects_unknown_field_in_strict_mode()
test_mail_sugar_normalizes_payload()
test_sms_sugar_normalizes_payload()
test_batch_groups_logs_with_batch_id()
test_custom_handler_invalid_class_rejected_at_runtime()
test_uuid_backfilled_via_job_queued_event()
No public properties found
No constants found
createJobCenterSchema()
requireRedis()
buildCacheRegistry()
setUp()
No protected properties found
N/A
makeType()
No private properties found
N/A

Methods

test_push_creates_pending_ledger_with_payload_snapshot()

test_push_creates_pending_ledger_with_payload_snapshot() : void

投递必建台账:待处理状态 + 载荷内容快照 + 来源上下文,任务进入队列

test_push_rejects_unregistered_type()

test_push_rejects_unregistered_type() : void

未登记队列拒绝投递

test_push_rejects_disabled_type()

test_push_rejects_disabled_type() : void

停用队列拒绝投递

test_push_rejects_missing_required_field()

test_push_rejects_missing_required_field() : void

载荷必填字段缺失拒绝投递(schema 声明驱动)

test_push_rejects_unknown_field_in_strict_mode()

test_push_rejects_unknown_field_in_strict_mode() : void

strict 队列拒绝未声明字段(防字段漂移)

test_mail_sugar_normalizes_payload()

test_mail_sugar_normalizes_payload() : void

邮件糖:载荷归一为 {to_email, data},分发内置 SendMailJob

test_sms_sugar_normalizes_payload()

test_sms_sugar_normalizes_payload() : void

短信糖:载荷归一为 {phone, data},分发内置 SendSmsJob

test_batch_groups_logs_with_batch_id()

test_batch_groups_logs_with_batch_id() : void

批次投递:同一 batch_id 归组多行台账

test_custom_handler_invalid_class_rejected_at_runtime()

test_custom_handler_invalid_class_rejected_at_runtime() : void

自定义处理器类无效(运行时被删/改名)拒绝投递——注册表建行绕过服务校验模拟脏数据

test_uuid_backfilled_via_job_queued_event()

test_uuid_backfilled_via_job_queued_event() : void

JobQueued 事件回填台账 uuid(真实 database 驱动:payload 内 uuid 与台账行关联, 原生队列表行同时落库——取消/失败对账的锚点;sync 驱动不触发该事件 uuid 留空)。

createJobCenterSchema()

createJobCenterSchema() : void

队列中心三表最小 schema(类型注册表 + 执行台账 + Laravel 原生队列表)

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

makeType()

makeType(string  $code = 'test_job', array  $overrides = []) : \App\Models\SysJobType

建启用自定义队列(默认走测试成功任务)

Parameters

string $code
array $overrides

Returns

\App\Models\SysJobType —