\Tests\FeatureDataRegionSearchTest

地区搜索与级联启停

被测对象:DataRegionService(search / updateStatus) 守护约定:任意层级名称/编码/拼音匹配 + path 祖先链定位;金字塔级联启停经前缀区间 命中自身 + 全部子孙,无关省不受影响。

Summary

Methods
Properties
Constants
test_update_status_cascades_via_prefix_range()
test_search_matches_name_substring_across_levels()
test_search_matches_pinyin_ignoring_spaces_and_case()
test_search_matches_code_prefix()
test_blank_keyword_returns_empty()
test_result_carries_ancestor_path_for_navigation()
test_limit_is_respected_and_clamped()
No public properties found
No constants found
requireRedis()
buildCacheRegistry()
setUp()
No protected properties found
N/A
buildSchema()
seedData()
service()
No private properties found
N/A

Methods

test_update_status_cascades_via_prefix_range()

test_update_status_cascades_via_prefix_range() : void

验证 updateStatus 前缀区间命中自身 + 全部子孙,无关省不受影响。

test_search_matches_name_substring_across_levels()

test_search_matches_name_substring_across_levels() : void

验证名称子串跨层级匹配(不限层级)。

test_search_matches_pinyin_ignoring_spaces_and_case()

test_search_matches_pinyin_ignoring_spaces_and_case() : void

验证拼音匹配忽略空格与大小写。

test_search_matches_code_prefix()

test_search_matches_code_prefix() : void

验证编码前缀匹配。

test_blank_keyword_returns_empty()

test_blank_keyword_returns_empty() : void

验证空关键词返回空集。

test_result_carries_ancestor_path_for_navigation()

test_result_carries_ancestor_path_for_navigation() : void

验证结果携带祖先链 path 供前端定位层级。

test_limit_is_respected_and_clamped()

test_limit_is_respected_and_clamped() : void

验证 limit 生效且越界夹到 [1, 100]。

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

buildSchema()

buildSchema() : void

seedData()

seedData() : void

service()

service() : \App\Services\Admin\DataRegionService

Returns

\App\Services\Admin\DataRegionService —