phpunit-test

Create or extend PHPUnit 9 tests under tests/ using ReflectionClass and bootstrap stubs.

6|1|Updated Jun 8, 2017
One-click install
npx skills add https://github.com/myadmin-plugins/opensrs-domains --skill phpunit-test
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: phpunit-test
Source: https://github.com/myadmin-plugins/opensrs-domains/tree/main/.claude/skills/phpunit-test
Command: npx skills add https://github.com/myadmin-plugins/opensrs-domains --skill phpunit-test

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Creates or extends PHPUnit 9 tests in tests/ following project patterns: ReflectionClass for structure tests, stub functions from tests/bootstrap.php, and requiring the namespace Detain\MyAdminOpenSRS\Tests. Use when user says 'add test', 'write tests', 'test coverage'. Do NOT use for non-test PHP files.

Core Features & Use Cases

  • Creates or extends PHPUnit 9 tests under tests/ that validate project structure via ReflectionClass.
  • Uses pre-defined stubs from tests/bootstrap.php to avoid real API calls and ensure isolated unit testing.
  • Enforces the namespace Detain\MyAdminOpenSRS\Tests for all test classes and provides scaffolding aligned with the plugin's testing conventions.

Quick Start

Ask me to add or extend tests and I will create PHPUnit tests under tests/ following the project's patterns.

Frequently Asked Questions about phpunit-test

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

FAQPage Schema
How do I write PHPUnit tests using ReflectionClass to validate class structure?

You can scaffold PHPUnit 9 tests by asking to add or extend tests, which generates files under tests/ using ReflectionClass for structure validation and bootstrap stubs for isolated unit testing, all within the Detain\MyAdminOpenSRS\Tests namespace.

What's the best way to add test coverage to a PHP project without making external API calls?

The best approach uses pre-defined stubs from tests/bootstrap.php to avoid real API calls, ensuring isolated unit testing while scaffolding PHPUnit 9 tests that validate project structure via ReflectionClass.

Does this PHPUnit scaffolding work with any PHP project or only specific plugin structures?

This PHPUnit scaffolding is tailored for PHP projects using the MyAdmin OpenSRS plugin structure, enforcing the Detain\MyAdminOpenSRS\Tests namespace and conventions. It does not apply to non-test PHP files or unrelated project architectures.

How do I scaffold a bootstrap.php stub for PHPUnit tests in a namespaced project?

Scaffolding a bootstrap.php stub involves creating predefined functions under tests/bootstrap.php that simulate dependencies, allowing PHPUnit tests to run in isolation. This Skill uses these stubs to enforce consistent test scaffolding within the Detain\MyAdminOpenSRS\Tests namespace.

Why should I not use this approach for writing non-test PHP files?

This approach is specifically scoped to create or extend PHPUnit 9 tests under tests/ using ReflectionClass and bootstrap stubs, enforcing the Detain\MyAdminOpenSRS\Tests namespace for test coverage only. It is not designed for non-test PHP files.

When do I need to enforce a specific namespace like Detain\MyAdminOpenSRS\Tests in PHPUnit tests?

You need to enforce the Detain\MyAdminOpenSRS\Tests namespace when scaffolding PHPUnit tests for the MyAdmin OpenSRS plugin structure, ensuring test classes align with project conventions and ReflectionClass-based structure validation patterns.