\Tests\UnitSchemaBootstrapTest

PostgreSQL schema 自举守卫

被测对象:AppServiceProvider::schemaToEnsure(migrate 前置的 schema 存在性守卫) 守护约定:仅 pgsql + 非空非 public 的 search_path 返回待建 schema 名; 非 pgsql(sqlite 测试环境)与 public 一律 null——迁移链零开销。

Summary

Methods
Properties
Constants
test_sqlite_driver_skips_schema_bootstrap()
test_public_search_path_skips_schema_bootstrap()
test_custom_schema_is_returned_for_bootstrap()
No public properties found
No constants found
requireRedis()
buildCacheRegistry()
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

test_sqlite_driver_skips_schema_bootstrap()

test_sqlite_driver_skips_schema_bootstrap() : void

非 pgsql 驱动(测试默认 sqlite):跳过 schema 自举。

test_public_search_path_skips_schema_bootstrap()

test_public_search_path_skips_schema_bootstrap() : void

pgsql + search_path=public:框架默认 schema 恒存在,跳过。

test_custom_schema_is_returned_for_bootstrap()

test_custom_schema_is_returned_for_bootstrap() : void

pgsql + 自定义 search_path:返回待建 schema 名(migrate 前置创建)。

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