## Root cause `route_t::hasPermission()` and `requirePermission()` are instance methods. Route code was invoking them with `self::`; the new XL Vask hall-scope helper made that call from a genuinely static context, causing PHP to throw: `Non-static method routes\\xlvaskUsageLogsRoute::hasPermission() cannot be called statically` ## Changes - Invoke route permission methods through `$this` across all 273 executable legacy calls in 45 route classes. - Make `xlvaskUsageLogsRoute::allowedHallIdsForUser()` an instance helper and update all 13 callers. - Preserve the existing all-scope and own-scope hall selection rules. - Add a token-aware regression test that rejects executable `self::hasPermission()` and `self::requirePermission()` calls, while ignoring comments. - Add focused XL Vask tests for global scanner hall scope and group-limited own scope. - Update affected route contract assertions to the instance-call form. ## Verification - PHP lint: all 53 changed PHP files - Focused PHPStan: changed XL Vask route and both new regression tests — clean - Focused regression slice: 58 passed, 748 assertions - Full local unit suite: 1,300 passed, 9,442 assertions (1 unrelated existing warning, 1 environment skip) - Full local API suite: 285 passed, 11,704 assertions - Exact-SHA GitHub Tests workflow: all 7 jobs passed (unit, API, integration, legacy, edge gateway, and supporting checks) - Independent exact-SHA QA gate: PASS, no findings - Independent exact-SHA security gate: PASS, no findings - Independent exact-SHA reviewer gate: PASS, no findings - Remote comparison: exactly one commit ahead of `40b104abed7723a7d1b7028190ecda0e7aeef829`; all 53 remote blob hashes matched the reviewed worktree ## Delivery state Draft only for human review. No merge or deployment is included. Qodana is skipped while the PR remains draft and is therefore not represented as a passed gate.
20 lines
1.3 KiB
PHP
20 lines
1.3 KiB
PHP
<?php
|
|
|
|
it('wires collected invoice customer moves through the dedicated route and permission', function (): void {
|
|
$routeContent = file_get_contents(app_path('routes/orderInvoicesRoute.php'));
|
|
$objectContent = file_get_contents(app_path('objects/collected_order_invoices_o.php'));
|
|
|
|
expect($routeContent)->not->toBeFalse()
|
|
->and($routeContent)->toContain("\$this->post('/collected-invoices/move-to-customer'")
|
|
->and($routeContent)->toContain("\$this->requirePermission('move_collected_invoice_customer')")
|
|
->and($routeContent)->toContain('$collected_order_invoices->moveToCustomer')
|
|
->and($routeContent)->toContain("\$response->add_meta('move', \$move_result)")
|
|
->and($objectContent)->not->toBeFalse()
|
|
->and($objectContent)->toContain('public function moveToCustomer(int $target_customer_number): array')
|
|
->and($objectContent)->toContain('Invoice collections with an external or booked invoice cannot be moved')
|
|
->and($objectContent)->toContain('SELECT id FROM orders WHERE invoice_collection_id = {$invoice_collection_id}')
|
|
->and($objectContent)->toContain('$order->customer_id->set($target_customer_number)')
|
|
->and($objectContent)->toContain('$this->customer_number->set($target_customer_number)')
|
|
->and($objectContent)->toContain('$db->conn()->begin_transaction()');
|
|
});
|