# Testing Structure

## Overview
23 test files organized into Unit and Feature test suites. Uses SQLite in-memory database for testing.

## Configuration (`phpunit.xml`)
- **Database:** `sqlite` / `:memory:` — In-memory database
- **Queue:** `sync` — Synchronous job execution
- **Cache:** `array` — No persistent cache
- **Environment:** `testing`
- **BCRYPT rounds:** `4` — Fast password hashing
- **Coverage:** Tracks `app` directory

## Test Suites

### Unit Tests (`tests/Unit/`)
Core domain logic and service tests:

**Feature Entitlement Tests:**
- `FeatureDefinitionTest` — Feature definition parsing
- `FeatureResultTest` — Feature result value object
- `FeatureValueTest` — Feature value resolution
- `PlanSnapshotTest` — Plan snapshot value object

**Service Tests:**
- `SubscriptionServiceTest` — Subscription operations
- `NotificationServiceTest` — Notification dispatching
- `VideoStorageUsageTest` — Storage usage tracking
- `NotificationEnginePipelineTest` — Notification pipeline testing

**Other:**
- `ExampleTest` — Basic smoke test

### Feature Tests (`tests/Feature/`)

**Participation Workflow Tests:**
- `MarathonWorkflowTest` — Full marathon participation workflow
- `CompetitionWorkflowTest` — Full competition participation workflow

**Other:**
- `ExampleTest` — Basic feature test

### Participation Unit Tests
Located in `tests/Unit/Participation/`:
- `CompetitionParticipationServiceTest`
- `EligibilityServiceTest`
- `MarathonParticipationServiceTest`
- `ParticipationAuditServiceTest`
- `ParticipationRequestServiceTest`
- `ParticipationServiceTest`
- `PaymentServiceTest`
- `SeatAllocationServiceTest`
- `StudentEnrollmentServiceTest`

## Base Test Case
`tests/TestCase.php` — CreatesApplication trait for Laravel bootstrapping.

## Testing Patterns
- **In-memory database** — Fast test execution without external dependencies
- **Synchronous queue** — Prevents async job issues in tests
- **Array cache** — Avoids cache contamination between tests
- **Feature tests** — Cover end-to-end participation workflows
- **Unit tests** — Cover individual service and domain logic
