fix: library entries read as not found without the library right (P12)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-09-27 01:07:53 +02:00
co-authored by Claude Opus 5.5
parent 48ecc627aa
commit 681bb755ff
5 changed files with 50 additions and 13 deletions
@@ -123,7 +123,7 @@ final class DiviPageLoaderTest extends TestCase
self::assertToolError((new DiviPageLoader($schema))->load(1058, false), 'not_found');
self::assertToolError(
(new DiviPageLoader($schema, new Parser(), LibraryFixtures::access(['divi_library'])))->load(1058, false),
'forbidden'
'not_found'
);
}
@@ -152,7 +152,7 @@ final class DiviReadAbilitiesTest extends TestCase
self::assertSame('https://kunde.test/wp-admin/post.php?post=1059&action=edit', $result['edit_url']);
}
public function testNodeGetOfALibraryItemAndRefusalsWithoutTheLibraryRight(): void
public function testNodeGetOfALibraryItemAndNotFoundWithoutTheLibraryRight(): void
{
LibraryFixtures::given([LibraryFixtures::item(1057, ['post_status' => 'private', 'post_title' => 'Geheim'])]);
$ability = new DiviNodeGetAbility(LibraryFixtures::loader(), $this->design());
@@ -162,9 +162,9 @@ final class DiviReadAbilitiesTest extends TestCase
$denied = new DiviNodeGetAbility(LibraryFixtures::loader(LibraryFixtures::access(['divi_library'])), $this->design());
$refusal = $denied->permission(['post_id' => 1057, 'id' => 'm0']);
self::assertToolError($refusal, 'forbidden');
self::assertToolError($refusal, 'not_found');
self::assertStringNotContainsString('Geheim', $refusal->get_error_message());
$outline = new DiviOutlineAbility(LibraryFixtures::loader(LibraryFixtures::access(['divi_library'])), $this->design());
self::assertToolError($outline->execute(['post_id' => 1057]), 'forbidden');
self::assertToolError($outline->execute(['post_id' => 1057]), 'not_found');
}
}