fix: full-form internal links follow the {{link:}} target rules (ruling P10)
One PostIdParser for {{link:}} and select_post; post_link_url_<type> needs a
living, readable, non-attachment target of exactly that type.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -19,6 +19,9 @@ final class WpLinkTargetsTest extends TestCase
|
||||
842 => new WP_Post(['ID' => 842, 'post_type' => 'page', 'post_status' => 'private']),
|
||||
843 => new WP_Post(['ID' => 843, 'post_type' => 'revision', 'post_status' => 'inherit']),
|
||||
844 => new WP_Post(['ID' => 844, 'post_type' => 'page', 'post_status' => 'auto-draft']),
|
||||
845 => new WP_Post(['ID' => 845, 'post_type' => 'attachment', 'post_status' => 'inherit', 'post_parent' => 0]),
|
||||
846 => new WP_Post(['ID' => 846, 'post_type' => 'attachment', 'post_status' => 'trash']),
|
||||
847 => new WP_Post(['ID' => 847, 'post_type' => 'attachment', 'post_status' => 'private']),
|
||||
];
|
||||
Functions\when('get_post')->alias(static fn (int $id): ?WP_Post => $posts[$id] ?? null);
|
||||
Functions\when('current_user_can')->alias(
|
||||
@@ -33,5 +36,8 @@ final class WpLinkTargetsTest extends TestCase
|
||||
self::assertNull($links->postTypeOf(843), 'revision');
|
||||
self::assertNull($links->postTypeOf(844), 'auto-draft');
|
||||
self::assertNull($links->postTypeOf(900), 'missing');
|
||||
self::assertNull($links->postTypeOf(845), 'unattached attachment');
|
||||
self::assertNull($links->postTypeOf(846), 'trashed attachment');
|
||||
self::assertNull($links->postTypeOf(847), 'attachment with an own status (ruling P10: no attachment)');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user