Install the latest version:
composer require actiophp/actio
Actio::setHandler($handler);
Run all tests with coverage:
composer test
Or run specific test suites:
composer test:unit # Unit tests only
composer test:integration # Integration tests only
Integration tests require local MySQL and PostgreSQL instances.
Configure your MySQL test database:
CREATE USER 'test'@'localhost' IDENTIFIED BY 'password1';
CREATE DATABASE actio_test;
GRANT ALL PRIVILEGES ON actio_test.* TO 'test'@'localhost';
FLUSH PRIVILEGES;
MySQL environment variables in .env.testing
:
- ACTIO_MYSQL_HOST (default: localhost)
- ACTIO_MYSQL_DB_NAME (default: actio_test)
- ACTIO_MYSQL_USERNAME (default: test)
- ACTIO_MYSQL_PASSWORD (default: password1)
Configure your PostgreSQL test database:
# Create test user and database
sudo -u postgres psql -c "CREATE USER test WITH PASSWORD 'password1';"
sudo -u postgres psql -c "CREATE DATABASE test WITH OWNER test;"
# Create schema for Actio tests
sudo -u postgres psql -d test -c "CREATE SCHEMA actio_test AUTHORIZATION test;"
sudo -u postgres psql -d test -c "GRANT ALL ON SCHEMA actio_test TO test;"
PostgreSQL environment variables in .env.testing
:
- ACTIO_PG_HOST (default: localhost)
- ACTIO_PG_DB_NAME (default: test)
- ACTIO_PG_SCHEMA (default: actio_test)
- ACTIO_PG_USERNAME (default: test)
- ACTIO_PG_PASSWORD (default: password1)
Run PHPStan (level 8):
composer phpstan
Code and ideas borrowed from https://github.com/jbroadway/analog