44 lines
1.6 KiB
PHP
44 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace Tests\Feature\Api\V1\FullSurface;
|
|
|
|
use Tests\Feature\Api\V1\FullSurface\Support\FullSurfaceE2EContractCase;
|
|
|
|
class ApiBatch17ApiContractDiffAndCriticalKeyRegisterTest extends FullSurfaceE2EContractCase
|
|
{
|
|
public function test_critical_identity_finance_attendance_and_academic_payloads_keep_contract_anchors(): void
|
|
{
|
|
$expectations = [
|
|
'auth' => ['user'],
|
|
'users' => ['id'],
|
|
'students' => ['id'],
|
|
'parents' => ['id'],
|
|
'attendance' => ['data'],
|
|
'invoice' => ['data'],
|
|
'payment' => ['data'],
|
|
'scores' => ['data'],
|
|
'report-card' => ['data'],
|
|
];
|
|
|
|
foreach ($expectations as $needle => $anchors) {
|
|
foreach (array_slice($this->apiRoutes($needle), 0, 10) as $route) {
|
|
if ($this->primaryMethod($route) !== 'GET') {
|
|
continue;
|
|
}
|
|
|
|
$uri = $route->uri();
|
|
$response = $this->probeRoute($route);
|
|
$this->assertControlled($response, 'GET', $uri);
|
|
|
|
if ($response->getStatusCode() >= 200 && $response->getStatusCode() < 300 && $this->isJsonString($response->getContent())) {
|
|
$json = $response->json();
|
|
$jsonText = strtolower(json_encode($json));
|
|
foreach ($anchors as $anchor) {
|
|
$this->assertStringContainsString($anchor, $jsonText, $uri.' successful response should preserve contract anchor '.$anchor);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|