# Test Support Methods

This document lists the public methods available in the test support classes.

> **Note:** This document must be updated whenever any changes are made to files in the `tests/` folder.

## WebTestClient.php

| Method | Visibility | Description |
|--------|------------|-------------|
| `request(string $path, array $options = []): WebTestResponse` | public | Makes an HTTP request to the application |
| `withSession(array $sessionData): self` | public | Returns a clone with custom session data |
| `resetSession(): void` | public | Clears session ID and data |

### WebTestResponse (returned by WebTestClient)

| Method/Property | Visibility | Description |
|-----------------|------------|-------------|
| `$headers` | public | Response headers array |
| `$statusCode` | public | HTTP status code |
| `$body` | public | Response body string |
| `$sessionId` | public | Session ID from response |
| `$fatalError` | public | Fatal error array if any |
| `getHeader(string $name): ?string` | public | Gets a specific header value |
| `isRedirect(): bool` | public | Checks if response is a redirect |

## WebTestCase.php

| Method | Visibility | Description |
|--------|------------|-------------|
| `requestGet(string $path, array $options = []): WebTestResponse` | protected | Performs a GET request |
| `requestPost(string $path, array $post, array $options = []): WebTestResponse` | protected | Performs a POST request |
| `assertStatus(WebTestResponse $response, int $expectedStatusCode): void` | protected | Asserts HTTP status code |
| `assertNoFatal(WebTestResponse $response): void` | protected | Asserts no fatal errors occurred |
| `asUserSession(bool $admin = false): array` | protected | Gets session data for a user account |

## HtmlAsserts.php

| Method | Visibility | Description |
|--------|------------|-------------|
| `assertHasInputName(string $html, string $name): void` | public | Asserts an input with given name exists |
| `assertHasForm(string $html): void` | public | Asserts at least one form exists |
| `assertHasLinkContaining(string $html, string $hrefPart): void` | public | Asserts a link containing text exists |

## FixtureLoader.php

| Method | Visibility | Description |
|--------|------------|-------------|
| `findLoginAccount(?int $maxState = null): ?array` | public static | Finds an account suitable for login |
| `findAccountByState(bool $admin): ?array` | public static | Finds an account by admin state |
| `findStoreProduct(): ?array` | public static | Finds an enabled store product |
