refactor(tests): remove redundant tests and fix assertion style

Remove subset/duplicate architecture tests already covered by broader
checks, and replace assertTrue(true) with self::addToAssertionCount(1)
for explicit no-exception-thrown intent.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-25 18:46:49 +01:00
parent cb5f7037b2
commit c609753570
19 changed files with 111 additions and 284 deletions

View File

@@ -631,52 +631,6 @@ function gridParseFilters(array $query, array $schema): array
return $parsed;
}
/**
* Normalize common limit/offset query params.
*
* @return array{0:int,1:int}
*/
function gridQueryLimitOffset(array $query, int $defaultLimit = 10, int $maxLimit = 100): array
{
$limit = (int) ($query['limit'] ?? $defaultLimit);
if ($limit < 1) {
$limit = $defaultLimit;
} elseif ($limit > $maxLimit) {
$limit = $maxLimit;
}
$offset = (int) ($query['offset'] ?? 0);
if ($offset < 0) {
$offset = 0;
}
return [$limit, $offset];
}
/**
* Normalize order/dir query params against an allow-list.
*
* @return array{0:string,1:string}
*/
function gridQueryOrderDir(array $query, array $allowedOrder, string $defaultOrder, string $defaultDir = 'asc'): array
{
if (!in_array($defaultDir, ['asc', 'desc'], true)) {
$defaultDir = 'asc';
}
$order = trim((string) ($query['order'] ?? $defaultOrder));
if (!in_array($order, $allowedOrder, true)) {
$order = $defaultOrder;
}
$dir = strtolower(trim((string) ($query['dir'] ?? $defaultDir)));
if (!in_array($dir, ['asc', 'desc'], true)) {
$dir = $defaultDir;
}
return [$order, $dir];
}
/**
* Read a trimmed string from query params.
*/
@@ -916,19 +870,3 @@ function gridNormalizeLabelList(mixed $value, string $separator = '||'): array
$items = array_values(array_filter($items, static fn (string $item): bool => $item !== ''));
return $items;
}
/**
* Normalize mixed values to a unique list of positive integer IDs.
*
* @return int[]
*/
function gridNormalizePositiveIntList(mixed $value): array
{
if (!is_array($value)) {
return [];
}
$ids = array_map('intval', $value);
$ids = array_values(array_filter($ids, static fn (int $id): bool => $id > 0));
return array_values(array_unique($ids));
}