\Tests\FeatureP2Batch2Test

测试基座(抽象基类)

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

Summary

Methods
Properties
Constants
test_create_quota_rejected_for_non_super()
test_create_quota_allowed_for_super_and_normalized()
test_user_show_includes_quota()
test_user_config_resource_route_model_binding()
test_update_company_clears_explicitly_nulled_fields()
test_update_company_absent_keys_untouched()
test_update_dept_clears_explicitly_nulled_fields()
test_cache_store_requires_name_key_description()
test_cache_ttl_layer_requires_ttl()
test_cache_tables_whitelist()
test_org_tree_drops_unconsumed_aggregates_and_accessors()
No public properties found
No constants found
requestErrors()
requireRedis()
buildCacheRegistry()
setUp()
No protected properties found
N/A
cacheStoreErrors()
$super
$normal
N/A

Properties

$super

$super : \App\Models\SysUser

Type

SysUser

$normal

$normal : \App\Models\SysUser

Type

SysUser

Methods

test_create_quota_rejected_for_non_super()

test_create_quota_rejected_for_non_super() : void

验证非超管 create 写入配额被拒绝(403)。

test_create_quota_allowed_for_super_and_normalized()

test_create_quota_allowed_for_super_and_normalized() : void

验证超管 create 写入配额放行且 0 归一化为 null。

test_user_show_includes_quota()

test_user_show_includes_quota() : void

验证用户详情含 quota 字段。

test_user_config_resource_route_model_binding()

test_user_config_resource_route_model_binding() : void

验证 user-configs 资源路由隐式绑定(2026-08-16 改名回归):apiResource 参数显式 user,不因资源名单数化失联。

test_update_company_clears_explicitly_nulled_fields()

test_update_company_clears_explicitly_nulled_fields() : void

验证公司可空字段显式清空落 null/空串/0(按列类型)。

test_update_company_absent_keys_untouched()

test_update_company_absent_keys_untouched() : void

验证未提交的公司键保持不动。

test_update_dept_clears_explicitly_nulled_fields()

test_update_dept_clears_explicitly_nulled_fields() : void

验证部门可空字段显式清空按列类型落空值。

test_cache_store_requires_name_key_description()

test_cache_store_requires_name_key_description() : void

验证缓存建立必填 name/key/description。

test_cache_ttl_layer_requires_ttl()

test_cache_ttl_layer_requires_ttl() : void

验证 layer=ttl 缺 ttl 被交叉校验拦截。

test_cache_tables_whitelist()

test_cache_tables_whitelist() : void

验证缓存依赖表名必须匹配 td_sys_* 白名单。

test_org_tree_drops_unconsumed_aggregates_and_accessors()

test_org_tree_drops_unconsumed_aggregates_and_accessors() : void

验证组织树下发零消费聚合字段且为常数级查询。

requestErrors()

requestErrors(\Illuminate\Foundation\Http\FormRequest  $request, string|null  $uri = null, string|null  $controller = null) : array<string,string[]>

独立校验 FormRequest 并返回错误集。

Parameters

\Illuminate\Foundation\Http\FormRequest $request
string|null $uri

路由模板(如 'templates/{id}');Request 的 withValidator 依赖 route 上下文时必传,否则可省略

string|null $controller

控制器@方法 串(路由绑定用,仅与 $uri 搭配)

Returns

array

校验错误集(通过时为空数组)

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

cacheStoreErrors()

cacheStoreErrors(array  $payload) : array<string,string[]>

Parameters

array $payload

Returns

array