Dodano mapę kodu w .paul/codebase/ (7 dokumentów)

Wygenerowano przez równoległą analizę czterech agentów: stack, architektura,
konwencje, integracje, testy, baza danych oraz wykryte problemy i dług techniczny.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-05 19:57:07 +02:00
parent 009141455c
commit 0776c4531e
7 changed files with 558 additions and 0 deletions

33
.paul/codebase/testing.md Normal file
View File

@@ -0,0 +1,33 @@
# Testing — rank24.pl
## Test Infrastructure
**No automated tests exist.** There are no:
- PHPUnit configuration files (`phpunit.xml`, `phpunit.xml.dist`)
- Test directories (`tests/`, `test/`, `spec/`)
- Test class files (`*Test.php`, `*Spec.php`)
- CI/CD pipeline that runs tests
## How Testing Is Done
All testing is **manual** via the web interface:
1. **Web UI testing** — load pages in browser, exercise forms and interactions
2. **AJAX endpoints**`ajax-check.php` used for health checks / spot validation
3. **Cron output**`cron.php` returns JSON; check via browser or log inspection
4. **PHP error logs**`error_reporting` is suppressed in production; errors must be caught via server logs or temporary enabling of reporting
## Debugging Aids
- **OPD debug console** — `$config['db']['debug']` enables query logging via `opd.debug.php`
- **`\S::pre()`** — utility for dumping variables (calls `var_dump` / `print_r`), used inline and commented out: `//\S::pre($results); exit;`
- **`file_put_contents('google-rank.txt', $result)`** — ad-hoc scraping debug log in `class.GoogleRank.php`
- **`$debbbb = $data`** — debug variable left in `class.S.php`
## Adding Tests (Guidance for Future)
If automated testing is introduced:
- PHPUnit is the natural choice for PHP
- Heavy global state (`$db`, `$mdb`, `$user`) makes unit testing hard without refactoring — start with integration tests against a test database
- Factory classes (`factory\*`) are the best seam for testing — they have clear input/output and centralize DB access
- Cron methods in `class.Cron.php` return `['status' => 'ok'|'empty', 'msg' => '...']` — easily assertable