fix: lit/library-list search by title, own entries for authors, cursor without hidden rows (L3)
search uses search_columns post_title; users without edit_others_posts on et_pb_layout query their own entries only (PostGuard::ownPostsOnly); the cursor counts the entries shown, never the rows left out. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -86,6 +86,8 @@ final class DiviLibraryStoreTest extends TestCase
|
||||
self::assertSame(21, $captured['posts_per_page']);
|
||||
self::assertSame(40, $captured['offset']);
|
||||
self::assertSame('Kopf', $captured['s']);
|
||||
self::assertSame(['post_title'], $captured['search_columns'], 'audit L3: the title only');
|
||||
self::assertArrayNotHasKey('author', $captured);
|
||||
self::assertSame(
|
||||
[
|
||||
'relation' => 'AND',
|
||||
@@ -97,6 +99,21 @@ final class DiviLibraryStoreTest extends TestCase
|
||||
);
|
||||
}
|
||||
|
||||
/** Audit L3: users without edit_others_posts query their own entries only. */
|
||||
public function testFindRestrictsToAnAuthor(): void
|
||||
{
|
||||
$captured = [];
|
||||
Functions\when('get_posts')->alias(static function (array $args) use (&$captured): array {
|
||||
$captured = $args;
|
||||
|
||||
return [];
|
||||
});
|
||||
|
||||
(new DiviLibraryStore())->find(['author' => 12], 20, 0);
|
||||
|
||||
self::assertSame(12, $captured['author']);
|
||||
}
|
||||
|
||||
public function testReportsMissingTaxonomies(): void
|
||||
{
|
||||
Functions\when('taxonomy_exists')->alias(static fn (string $taxonomy): bool => $taxonomy !== 'scope');
|
||||
|
||||
Reference in New Issue
Block a user