\Tests\FeatureUserConfigExporterTest

用户 CSV 导出回归

被测对象:UserConfigExporter::exportCsv 守护约定:① 输出含 BOM(Excel 直开)与 12 列表头 ② 状态/超管列中文文案 ③ 以 = + - @ 开头的单元格被前置单引号(公式注入防护) ④ 超管用户导出全量(数据范围豁免与列表同规)。

Summary

Methods
Properties
Constants
test_export_contains_header_and_renders_labels()
test_export_escapes_formula_injection_cells()
test_export_empty_db_yields_header_only()
No public properties found
No constants found
requireRedis()
buildCacheRegistry()
setUp()
No protected properties found
N/A
captureCsv()
No private properties found
N/A

Methods

test_export_contains_header_and_renders_labels()

test_export_contains_header_and_renders_labels() : void

表头与列文案:12 列表头、状态/超管中文文案、按 id 升序

test_export_escapes_formula_injection_cells()

test_export_escapes_formula_injection_cells() : void

公式注入防护:以 = + - @ 开头的用户名被前置单引号

test_export_empty_db_yields_header_only()

test_export_empty_db_yields_header_only() : void

空库导出:只有 BOM + 表头(无数据行)

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

captureCsv()

captureCsv() : string

捕获 StreamedResponse 的流式输出(BOM + CSV 全文)

Returns

string —