fix: link targets never reveal library entries by type (ruling Q14)
WpLinkTargets answers the library, internal "_" types and every type without a Divi post_link_url option like a missing ID; replace-text strips library IDs only from global subtrees. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -5,6 +5,7 @@ declare(strict_types=1);
|
||||
namespace LIT\MCP\Tests\Unit\Integrations\Divi\Pages;
|
||||
|
||||
use Brain\Monkey\Functions;
|
||||
use LIT\MCP\Integrations\Divi\Pages\WpLinkTargets;
|
||||
use LIT\MCP\Integrations\Divi\Pages\WpValueSanitizer;
|
||||
use LIT\MCP\Tests\Unit\TestCase;
|
||||
use WP_Post;
|
||||
@@ -72,7 +73,7 @@ final class WpValueSanitizerTest extends TestCase
|
||||
default => null,
|
||||
});
|
||||
Functions\when('current_user_can')->alias(static fn (string $cap, int $id): bool => $id !== 16);
|
||||
$sanitizer = new WpValueSanitizer();
|
||||
$sanitizer = new WpValueSanitizer(new WpLinkTargets(static fn (string $type): bool => $type !== 'wp_block'));
|
||||
|
||||
self::assertSame('page', $sanitizer->linkTargetType(12));
|
||||
self::assertSame('post', $sanitizer->linkTargetType(20));
|
||||
|
||||
Reference in New Issue
Block a user