\Tests\FeatureG15ConfigEncryptionTest

测试基座(抽象基类)

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

Summary

Methods
Properties
Constants
test_set_get_roundtrip_with_ciphertext_at_rest()
test_settab_gettab_roundtrip()
test_placeholder_keeps_original_value()
test_save_flat_encrypts_sensitive_values()
test_save_tabs_encrypts_sensitive_values()
test_save_placeholder_keeps_original_value()
test_group_masks_ciphertext()
test_group_masks_sensitive_default_value()
test_non_sensitive_values_unaffected()
test_migration_command_encrypts_legacy_plaintext_idempotent()
No public properties found
No constants found
makeDef()
requireRedis()
buildCacheRegistry()
No protected properties found
N/A
storedValue()
No private properties found
N/A

Methods

test_set_get_roundtrip_with_ciphertext_at_rest()

test_set_get_roundtrip_with_ciphertext_at_rest() : void

验证敏感键 set/get 回环且库内为 enc: 前缀密文(不含明文)。

test_settab_gettab_roundtrip()

test_settab_gettab_roundtrip() : void

验证 tabs 敏感键 setTab/getTab 回环且密文落库。

test_placeholder_keeps_original_value()

test_placeholder_keeps_original_value() : void

验证占位 ****** 与空串保持原值(掩码语义)。

test_save_flat_encrypts_sensitive_values()

test_save_flat_encrypts_sensitive_values() : void

验证 save() flat 分支对敏感键密文落库(既往 G15 旁路回归守护)。

test_save_tabs_encrypts_sensitive_values()

test_save_tabs_encrypts_sensitive_values() : void

验证 save() tabs 分支对敏感键密文落库。

test_save_placeholder_keeps_original_value()

test_save_placeholder_keeps_original_value() : void

验证 save() 批量路径的掩码占位与空串同样保持原值(掩码语义不因批量路径漂移)。

test_group_masks_ciphertext()

test_group_masks_ciphertext() : void

验证 group 只下发掩码、不泄露密文/明文。

test_group_masks_sensitive_default_value()

test_group_masks_sensitive_default_value() : void

验证敏感项 default_value 与 value 同规掩码(管理面零明文下发)。

test_non_sensitive_values_unaffected()

test_non_sensitive_values_unaffected() : void

验证非敏感键保持明文落库。

test_migration_command_encrypts_legacy_plaintext_idempotent()

test_migration_command_encrypts_legacy_plaintext_idempotent() : void

验证加密迁移命令将存量明文原地加密且幂等(重复执行零变化)。

makeDef()

makeDef(string  $key, string  $type, mixed  $default = null, string  $validation = '', string  $options = '', int  $isTabs) : \App\Models\SysConfigDefinition

创建测试配置定义(TEST 组,静态来源)

Parameters

string $key
string $type
mixed $default
string $validation
string $options
int $isTabs

Returns

\App\Models\SysConfigDefinition —

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

storedValue()

storedValue(string  $key, string  $tabKey = '') : ?string

Parameters

string $key
string $tabKey

Returns

?string —