This commit is contained in:
2026-05-19 20:50:31 +02:00
parent cff0635aff
commit 2df4638365
442 changed files with 1426 additions and 159692 deletions

View File

@@ -1,41 +1,54 @@
# Testing
# Testowanie
Last refresh: 2026-05-18.
**Aktualizacja:** 2026-05-19
## Framework
## Stack testowy
- Test framework: PHPUnit 11.5 through `phpunit.xml`.
- **PHPUnit 11.5** + **dg/bypass-finals 1.9** (mockowanie klas `final`).
- Konfiguracja: `phpunit.xml`.
- Bootstrap: `tests/bootstrap.php`.
- Test namespace: `Tests\\`.
- Test location: `tests/Unit/`.
- `DG\\BypassFinals::enable()` is enabled in `tests/bootstrap.php` for mocking final classes.
- PHPUnit fails on warnings and risky tests.
- Komenda: `composer test` -> `vendor/bin/phpunit -c phpunit.xml --testdox`.
## Commands
## Lokalizacja testow
- Full PHP suite: `composer test`.
- Direct PHPUnit: `vendor/bin/phpunit -c phpunit.xml --testdox`.
- Frontend assets: `npm run build:assets`.
- `npm test` is a placeholder that exits with an error.
Wszystko w `tests/Unit/` (21 plikow). Brak testow integracyjnych ani e2e w repo.
## Existing Coverage Shape
## Pokryte obszary
- Services/mappers/repositories: `tests/Unit/ErliOrdersSyncServiceTest.php`, `tests/Unit/ErliOrderMapperTest.php`, `tests/Unit/FakturowniaInvoiceIdempotencyTest.php`, `tests/Unit/OrdersStatisticsRepositoryTest.php`.
- Shipping/integration services: `tests/Unit/AllegroShipmentServiceTest.php`, `tests/Unit/ApaczkaShipmentServiceTest.php`, `tests/Unit/PolkurierShipmentServiceTest.php`.
- Security/config: `tests/Unit/SmtpSecurityContextFactoryTest.php`, `tests/Unit/AllegroTokenManagerTest.php`.
- View-rendering style check: `tests/Unit/ShipmentPreparePolkurierMappingTest.php`.
| Test | Pokryta domena |
|---|---|
| `AllegroOrderImportServiceTest.php` | mapowanie zamowien Allegro -> wewnetrzny model |
| `AllegroShipmentServiceTest.php` | tworzenie etykiet/shipmentow Allegro |
| `AllegroStatusSyncServiceTest.php` | sync statusow Allegro -> orderPRO |
| `AllegroTokenManagerTest.php` | OAuth refresh tokenu Allegro |
| `ApaczkaShipmentServiceTest.php` | etykiety Apaczka |
| `AutomationServiceTest.php` | silnik regul automatyzacji |
| `DeliveryStatusTest.php` | model statusow dostaw |
| `ErliExternalShipmentServiceTest.php` | shipment Erli |
| `ErliOrderMapperTest.php` | mapowanie zamowien Erli |
| `ErliOrdersSyncServiceTest.php` | sync zamowien Erli |
| `ErliStatusSyncServiceTest.php` | sync statusow Erli |
| `FakturowniaInvoiceIdempotencyTest.php` | idempotencja faktur (migracja `000118`) |
| `OrderImportRepositoryTest.php` | upsert zamowien |
| `OrderSourceRegistryTest.php` | rejestr zrodel zamowien |
| `OrdersRepositoryNotesCountTest.php` | licznik notatek w liscie zamowien |
| `OrdersStatisticsRepositoryTest.php` | agregaty statystyk |
| `PolkurierShipmentServiceTest.php` | etykiety Polkurier |
| `ReceiptServiceNetCalculationTest.php` | wyliczenia netto na paragonach |
| `ShipmentPreparePolkurierMappingTest.php` | mapowanie metod dostaw Polkurier |
| `SmtpSecurityContextFactoryTest.php` | konfiguracja SMTP (self-signed dev) |
| `TemplateVariableCatalogTest.php` | katalog zmiennych szablonow Email/SMS |
## Gaps
## Luki w pokryciu
- No dedicated browser/e2e suite found.
- No frontend JS test suite found for `public/assets/js/modules/*.js`.
- No controller HTTP integration test suite found for `routes/web.php` and controllers.
- No migration integration test suite found for `database/migrations/`.
- Windows print client under `clients/windows/OrderPROPrint/` has no obvious automated tests.
- **InPost** — brak testow `InpostShipmentService` / `InpostTrackingService`.
- **Shoppro** — brak testow `ShopproOrdersSyncService`, `ShopproStatusSyncService`, `ShopproPaymentStatusSyncService`, `ShopproOrderMapper` (867 lin).
- **Kontrolery** — zero testow HTTP / feature.
- **Statystyki UI** — pokryty tylko repository, nie kontroler.
- **Email/SMS sending** — brak testow `EmailSendingService`, `HostedSmsApiClient`, `SmsplanetApiClient`.
- **Notifications, Printing, Users, Auth** — brak testow.
## Practical Verification Guidance
## Komendy
- For narrow service/repository changes, run the nearest `tests/Unit/*Test.php` first.
- For shared behavior, integration wiring, or risky changes, run `composer test`.
- For UI/SCSS changes, run `npm run build:assets` and manually verify the affected view.
- For cron/integration work, test the target service/repository and smoke the relevant handler in `src/Modules/Cron/`.
- Pojedynczy test: `vendor/bin/phpunit tests/Unit/<NazwaTestu>.php`.
- Filtr: `composer test -- --filter NazwaTestu`.