fix(ticket): register the ticket schema inside the users sections array
/users/ticket loaded in the SPA but the form never did: the console showed "未知的设置分组: ticket" from /settings/schema/users/ticket. The ticket section was composed one array level too high in SchemaUsers::build() — as a sibling of 'sections' rather than inside it — so SchemaProvider::get_sections(), which reads only $schema['sections'], never saw it and the REST handler 404'd. Every other axis was wired correctly: the route, the menu entry, users/ticket.js and SchemaUsersTicket itself. That is why only this page failed while sibling /users/* pages worked. Move the entry inside sections. The contract test could not catch this because it asserted only that the compose call appears somewhere in the file. Replace it with a bracket-balanced scan that locates the sections array bounds and asserts the compose call falls inside, so nesting mistakes are visible. Also update the two ticket contract tests that still read the trait from src/Ticket/TicketRepository-traits/, its pre-flattening path. They assert on the trait's contents, so they were silently skipping the very file the earlier fatal was about. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
ffd8d7d1b7
commit
d32bdc0581
4 files changed
+27
-5
No files matched your search
@@ -116,7 +116,7 @@ test('closed tickets refuse replies and cannot be re-closed', () => {
|
||||
assert.match(admin, /if \(!empty\(\$ticket\['is_closed'\]\)\) \{\s*\n\s*return new \\WP_Error\('aksrt_ticket_closed'/);
|
||||
|
||||
// close_ticket 自身也挡已完结(双保险,避免前端绕过 UI 直接 POST)。
|
||||
const status = read('src/Ticket/TicketRepository-traits/TicketStatus.php');
|
||||
const status = read('src/Ticket/TicketStatus.php');
|
||||
assert.match(status, /if \(TicketStatusService::is_closed\(\(string\) \(\$ticket\['status'\] \?\? ''\)\)\) \{\s*\n\s*return false;/);
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user