Files
rank24.pl/.paul/codebase/testing.md
Jacek Pyziak 0776c4531e 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>
2026-05-05 19:57:07 +02:00

1.6 KiB

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 endpointsajax-check.php used for health checks / spot validation
  3. Cron outputcron.php returns JSON; check via browser or log inspection
  4. PHP error logserror_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