* Execute a source health check for one source id. * * @return array */
(string $id)
| 74 | * @return array<string,mixed> |
| 75 | */ |
| 76 | public static function testById(string $id): array |
| 77 | { |
| 78 | $id = trim($id); |
| 79 | if ($id === '') { |
| 80 | throw new RuntimeException('Missing source id', 400); |
| 81 | } |
| 82 | |
| 83 | $source = SourcesConfig::getSource($id); |
| 84 | if (!$source) { |
| 85 | throw new RuntimeException('Source not found', 404); |
| 86 | } |
| 87 | |
| 88 | $result = SourceHealth::check($source); |
| 89 | return self::normalizeHealthResult($result, 'Test did not return a result'); |
| 90 | } |
| 91 | |
| 92 | /** |
| 93 | * @param array<string,mixed>|null $resultSource |
no test coverage detected