php-test-setup

Configure PHP projects for unit testing with hyperf/testing and co-phpunit.

3|1|Updated Apr 18, 2021
One-click install
npx skills add https://github.com/nashgao/mqtt-client --skill php-test-setup
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: php-test-setup
Source: https://github.com/nashgao/mqtt-client/tree/main/.claude/skills/php-test-setup
Command: npx skills add https://github.com/nashgao/mqtt-client --skill php-test-setup

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill automates the setup of a robust PHP unit testing environment using the hyperf/testing framework and co-phpunit, ensuring coroutine support and efficient testing workflows.

Core Features & Use Cases

  • Dependency Installation: Installs hyperf/testing, mockery/mockery, and phpunit/phpunit.
  • Configuration: Generates phpunit.xml and test/bootstrap.php for comprehensive test execution.
  • Composer Scripts: Configures composer.json with scripts for running tests, coverage, and filtered tests.
  • Base Test Class: Provides a foundational TestCase class integrating with hyperf/testing and Mockery.
  • Use Case: Quickly prepare any new or existing PHP project for rigorous unit testing, ensuring all tests are executed reliably within a coroutine-aware environment.

Quick Start

Execute the command to set up the PHP unit testing environment for your project.

Frequently Asked Questions about php-test-setup

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

FAQPage Schema
How do I set up PHPUnit with coroutine support in a PHP project?

To set up PHPUnit with coroutine support, you need the hyperf/testing framework and co-phpunit. This process involves installing testing dependencies, generating phpunit.xml and test/bootstrap.php, and configuring composer scripts to execute tests within a coroutine-aware environment.

What is needed to configure a PHP testing environment using Hyperf?

Configuring a PHP testing environment using Hyperf requires installing hyperf/testing, mockery/mockery, and phpunit/phpunit. You also need to generate configuration files like phpunit.xml and test/bootstrap.php, alongside a base TestCase class for integration.

Does co-phpunit work with Hyperf for unit testing?

Yes, co-phpunit works with Hyperf by using the hyperf/testing framework. This combination ensures that your unit tests are executed reliably within a coroutine-enabled environment, providing a base TestCase class for integration.

How do I automate PHP unit testing dependency installation and configuration?

You can automate PHP unit testing dependency installation by configuring composer scripts in composer.json. This setup automatically installs required packages like phpunit/phpunit and generates the necessary phpunit.xml and bootstrap.php files for test execution.

What is the best way to run filtered unit tests in a coroutine-aware PHP application?

The best way to run filtered unit tests in a coroutine-aware PHP application is by using co-phpunit with configured composer scripts. This setup leverages the hyperf/testing framework and a base TestCase class to ensure reliable execution.