# Phase 7 Rollback — Tests + Postman Collection

## What Phase 7 Added

**New files (all test/doc only — safe to keep or delete):**
- `tests/Feature/Wani/PingTest.php`
- `tests/Feature/Wani/RegistryTest.php`
- `tests/Feature/Wani/HotspotDiscoveryTest.php`
- `tests/Feature/Wani/AuthFlowTest.php`
- `tests/Feature/Wani/SessionTest.php`
- `tests/Wani/PM-WANI-XML.postman_collection.json`

**Modified files:** NONE
**Database changes:** NONE
**Production behavior:** NONE CHANGED — tests run against in-memory SQLite, no production impact

## How to Roll Back (Local)

```bash
cd c:/xampp/htdocs/Android_App/pmwani_mobile_app_backend

rm -rf tests/Feature/Wani/
rm -rf tests/Wani/
```

That's it — tests only, no app logic touched.

## What's In Here

### Feature Tests (17 passing, 2 MySQL-only)

```bash
php artisan test --filter=Wani
```

| Test File | What It Covers |
|---|---|
| `PingTest.php` | Ping works, 404 returns XML, 405 returns XML |
| `RegistryTest.php` | PDOA list, excludes inactive, excludes non-PDOA |
| `HotspotDiscoveryTest.php` | Nearby search, distance filter, missing params (MySQL-only) |
| `AuthFlowTest.php` | Token issue, unknown user, unverified, validate, expired, reused |
| `SessionTest.php` | Session status, end, not found, already ended |

### Postman Collection

Located at: `tests/Wani/PM-WANI-XML.postman_collection.json`

Import into Postman to get:
- 7 endpoints (ping → registry → hotspots → auth/initiate → auth/validate → session/status → session/end)
- 4 error-case requests
- Auto-capture of tokens into collection variables (`auth_token` and `session_token` are extracted from responses and reused in next request)

### Base URL Variable

Default: `https://flutter.pmwani.net/api/wani/v1`

Change to local:
```
http://127.0.0.1:8000/api/wani/v1
```

### Run the Full Flow (Postman)

1. Run **0. Ping** — verify server up
2. Run **1. Registry** — see all PDOAs
3. Run **2. Hotspots** — find nearby networks
4. Run **3. Auth Initiate** — token auto-saves to `{{auth_token}}`
5. Run **4. Auth Validate** — session token auto-saves to `{{session_token}}`
6. Run **5. Session Status** — check state
7. Run **6. Session End** — close session

All variables flow automatically between requests.

## Deploy Note

Tests and Postman collection do NOT need to be deployed to the server.
They stay in the dev repo for local validation only.

If you want them on the server anyway for CI:
```bash
scp -r -P 21212 tests/Feature/Wani/ immunity@147.93.30.127:/var/www/mobile_app_backend/tests/Feature/
scp -P 21212 -r tests/Wani/ immunity@147.93.30.127:/var/www/mobile_app_backend/tests/
```
