custom-php-running-test

Runs PHP and Laravel tests through Laravel Sail containers.

1|Updated Apr 3, 2021
One-click install
npx skills add https://github.com/NaoyaMiyagawa/dotfiles --skill custom-php-running-test-naoyamiyagawa
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: custom-php-running-test
Source: https://github.com/NaoyaMiyagawa/dotfiles/tree/main/.ai/skills/custom-php-running-test
Command: npx skills add https://github.com/NaoyaMiyagawa/dotfiles --skill custom-php-running-test-naoyamiyagawa

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Running PHPUnit or Pest directly on the host often fails or produces false results because PHP extensions, environment variables, and database services do not match the project. This Skill ensures tests always execute inside the Laravel Sail Docker stack so results reflect the real project environment. ## Core Features & Use Cases - Sail-only test execution: Runs tests via ./vendor/bin/sail artisan test with optional file paths or --filter= arguments. - Minimal container startup: Checks that Sail services are running and starts only the required containers such as app and the database service. - Environment guardrails: Blocks host-side runners like pest, phpunit, or php artisan test unless the user explicitly says Sail is not used. - Use Case: After editing a Laravel model, ask the assistant to run only the affected test files, and it will verify the Sail stack is up and execute ./vendor/bin/sail artisan test tests/Feature/OrderTest.php. ## Quick Start Run the tests for the files I just changed using Laravel Sail.

Frequently Asked Questions about custom-php-running-test

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run Laravel tests with Sail?

Run tests with ./vendor/bin/sail artisan test, optionally passing a file path or --filter to narrow the run. Omit the path to execute the full suite inside the Sail app container.

Why should I not run phpunit or pest directly on the host?

Host-side runners use the local PHP setup, which may lack required extensions, the correct .env values, or access to project database services. Running inside Sail guarantees the test environment matches the project configuration.

What Sail containers are needed to run Laravel tests?

At minimum the app container must be running so sail artisan test can execute. Tests that hit a database also need the relevant service such as mysql, mariadb, or pgsql, and sometimes redis, started via sail up -d with those service names.

Should I run the full Laravel test suite locally or in CI?

For wide-scope runs spanning a whole module or repository, prefer committing and pushing so CI runs the suite. CI shards test execution and finishes noticeably faster than a full local run on Sail.

What happens if Sail or Docker is not running?

If ./vendor/bin/sail is missing or Docker is down, the Skill stops and reports the problem. It does not fall back to a host-side test runner, since that would produce unreliable results.