src/holds the library source (primary entry:src/Model/Model.php) under theFreshsauce\\namespace.tests/contains PHPUnit tests (e.g.,tests/Model/CategoryTest.php).test-src/provides example models used by tests (App\\namespace).- Root config files:
composer.json,phpunit.xml.dist, anddocker-compose.yml.
composer installinstalls dependencies (PHP >= 8.3,ext-pdo, PHPUnit 10).vendor/bin/phpunit -c phpunit.xml.distruns the test suite.vendor/bin/phpstan analyse -c phpstan.neonruns static analysis.vendor/bin/php-cs-fixer fixformats the codebase (use--dry-run --diffin CI).docker-compose up -dstarts local MariaDB and PostgreSQL instances (ports 3306 and 5432).
- PHP code uses 4-space indentation and namespaces.
- Class names are
StudlyCaps(e.g.,Model,CategoryTest); methods arecamelCase. - Table config is set via static properties like
static protected $_tableName. - Follow PSR-4 autoloading (
Freshsauce\\->src/,App\\->test-src/).
- PHPUnit 10 is the test runner; tests live in
tests/. - Test classes are named
*Testand extendPHPUnit\Framework\TestCase. - Tests can run against MySQL/MariaDB or PostgreSQL; configure via env vars:
MODEL_ORM_TEST_DSN(e.g.,mysql:host=127.0.0.1;port=3306orpgsql:host=127.0.0.1;port=5432;dbname=categorytest)MODEL_ORM_TEST_USER,MODEL_ORM_TEST_PASS
- MySQL tests create/drop
categorytest; PostgreSQL tests create/drop thecategoriestable.
- Commit messages in this repo are short, descriptive sentences (e.g., “Fix test”, “Scrutinizer adjustments”).
- Prefer imperative or present-tense summaries without a required prefix.
- PRs should include a concise description, testing notes (
vendor/bin/phpunit -c phpunit.xml.dist), and any DB/setup changes.
- Default test connection assumes MySQL on
127.0.0.1:3306withroot/empty password. - For PostgreSQL, use the Docker defaults (
postgres/postgres) anddbname=categorytest. - Ensure ports
3306and/or5432are free and reachable from PHP.