fix: global usages follow the Theme Builder access (ruling Q17 M1)
GlobalUsages gets the Theme Builder access injected as a closure (ThemeBuilderAccess::usageState(), wired at both construction sites through DiviIntegration::globalUsages()). Theme Builder posts are named only while the Theme Builder is visible to the account, otherwise only counted (also in blocked_ids); a global edit that changes them needs canUse(), a writable "Divi Theme Builder" group and edit_post. Without an injected access the fail-safe default checks what canUse() checks. The duplicate THEME_BUILDER_TYPES list gives way to DiviThemeBuilder::postTypes(). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01At3V6SjwbMe6eMzVGW3Hs7
This commit is contained in:
@@ -118,12 +118,15 @@ final class LibraryFixtures
|
||||
*
|
||||
* @param list<array{id: int, status: string, type: string}>|\Closure(int): list<array{id: int, status: string, type: string}> $rows
|
||||
*/
|
||||
public static function usages(array|\Closure $rows, ?DiviRoles $roles = null): GlobalUsages
|
||||
{
|
||||
public static function usages(
|
||||
array|\Closure $rows,
|
||||
?DiviRoles $roles = null,
|
||||
?\Closure $themeBuilder = null
|
||||
): GlobalUsages {
|
||||
Functions\when('_get_non_cached_ids')->returnArg(1);
|
||||
Functions\when('_prime_post_caches')->justReturn(null);
|
||||
Functions\when('wp_cache_delete')->justReturn(true);
|
||||
$usages = Mockery::mock(GlobalUsages::class, [null, $roles ?? self::roles()])->makePartial();
|
||||
$usages = Mockery::mock(GlobalUsages::class, [null, $roles ?? self::roles(), $themeBuilder])->makePartial();
|
||||
$usages->allows('rows')->andReturnUsing(static fn (int $id): array => is_array($rows) ? $rows : $rows($id));
|
||||
|
||||
return $usages;
|
||||
|
||||
Reference in New Issue
Block a user