Files
alrahma_sunday_school_api/tests/Feature/Api/V1/FullSurface/ApiBatch17StudentIdentityMergeSplitContractTest.php
2026-06-11 11:46:12 -04:00

36 lines
1.3 KiB
PHP

<?php
namespace Tests\Feature\Api\V1\FullSurface;
use Tests\Feature\Api\V1\FullSurface\Support\FullSurfaceE2EContractCase;
class ApiBatch17StudentIdentityMergeSplitContractTest extends FullSurfaceE2EContractCase
{
public function test_merge_split_and_duplicate_student_identity_routes_reject_unsafe_payloads(): void
{
$routes = $this->apiRoutesContainingAny(['merge', 'split', 'duplicate', 'dedupe', 'students', 'identity', 'profile']);
$payload = [
'primary_student_id' => $this->ids['studentId'],
'secondary_student_id' => $this->ids['studentId'],
'target_student_id' => 999999,
'source_student_id' => $this->ids['studentId'],
'parent_id' => 999999,
'preserve_finance' => false,
'preserve_attendance' => false,
'force_merge' => true,
'skip_guardian_review' => true,
];
foreach (array_slice($routes, 0, 70) as $route) {
$method = $this->primaryMethod($route);
if (! in_array($method, ['POST', 'PUT', 'PATCH', 'DELETE'], true)) {
continue;
}
$uri = $route->uri();
$response = $this->requestAs($this->parent, $method, $uri, $this->payloadFor($method, $uri) + $payload);
$this->assertControlled($response, $method, $uri);
}
}
}