- Introduced `safety_seal` column in the `orders` table. - Updated order creation and completion logic to handle safety seal values. - Enhanced order and booking classes to manage safety seal attachment and retrieval. - Added tests to validate safety seal functionality in order processing.
65 lines
2.9 KiB
PHP
65 lines
2.9 KiB
PHP
<?php
|
|
|
|
it('exposes chauffeur management endpoints on the subusers route', function (): void {
|
|
$routeFile = app_path('routes/subusersRoute.php');
|
|
expect(is_file($routeFile))->toBeTrue();
|
|
|
|
$code = (string)file_get_contents($routeFile);
|
|
$normalized = preg_replace('/\s+/', ' ', $code);
|
|
|
|
expect($normalized)->toContain("\$this->post('/subusers/invite', function () {");
|
|
expect($normalized)->toContain("\$this->post('/subusers/invite/resend', function () {");
|
|
expect($normalized)->toContain("\$this->put('/subusers', function () {");
|
|
expect($normalized)->toContain("\$this->put('/subusers/me', function () {");
|
|
});
|
|
|
|
it('includes grant management fields in the subusers payload builder', function (): void {
|
|
$routeFile = app_path('routes/subusersRoute.php');
|
|
expect(is_file($routeFile))->toBeTrue();
|
|
|
|
$code = (string)file_get_contents($routeFile);
|
|
$normalized = preg_replace('/\s+/', ' ', $code);
|
|
|
|
expect($normalized)->toContain("'grant_id' =>");
|
|
expect($normalized)->toContain("'grant_enabled' =>");
|
|
expect($normalized)->toContain("'grant_note' =>");
|
|
expect($normalized)->toContain("'grant_permissions' =>");
|
|
expect($normalized)->toContain("'setup_required' =>");
|
|
expect($normalized)->toContain("'invite_accepted' =>");
|
|
expect($normalized)->toContain("'can_resend_invite' =>");
|
|
expect($normalized)->toContain("'profile_editable_by_manager' => false");
|
|
expect($normalized)->toContain("'access_state' =>");
|
|
});
|
|
|
|
it('links grant disable operations to SUBUSERS_DELETE for own-customer managers', function (): void {
|
|
$routeFile = app_path('routes/subusersRoute.php');
|
|
expect(is_file($routeFile))->toBeTrue();
|
|
|
|
$code = (string)file_get_contents($routeFile);
|
|
$normalized = preg_replace('/\s+/', ' ', $code);
|
|
|
|
expect($normalized)->toContain("definePermission('delete_own_subusers', subusers_permission_node_key::SUBUSERS_DELETE)");
|
|
expect($normalized)->toContain("requireManagedCustomerScope(subusers_permission_node_key::SUBUSERS_DELETE, \$targetCustomer);");
|
|
});
|
|
|
|
it('prevents own-customer managers from editing driver-owned account profiles', function (): void {
|
|
$routeFile = app_path('routes/subusersRoute.php');
|
|
expect(is_file($routeFile))->toBeTrue();
|
|
|
|
$code = (string)file_get_contents($routeFile);
|
|
$normalized = preg_replace('/\s+/', ' ', $code);
|
|
|
|
expect($normalized)->toContain("Customers can only manage subuser grants. Drivers own their account profile.");
|
|
});
|
|
|
|
it('only allows invite resend while setup is still pending', function (): void {
|
|
$routeFile = app_path('routes/subusersRoute.php');
|
|
expect(is_file($routeFile))->toBeTrue();
|
|
|
|
$code = (string)file_get_contents($routeFile);
|
|
$normalized = preg_replace('/\s+/', ' ', $code);
|
|
|
|
expect($normalized)->toContain("Driver account already accepted the invitation.");
|
|
expect($normalized)->toContain("if (!\$subuser->requiresSetup()) {");
|
|
});
|