phpunit-skill
phpunit-skill streamlines the creation of PHPUnit test suites by automating test case generation, assertion setup, and lifecycle method configuration. Designed for developers building robust PHP testing workflows, this skill reduces boilerplate code and accelerates test-driven development cycles.
phpunit-skill helps you write PHPUnit tests by automating test case generation, assertion setup, and lifecycle method configuration. To write tests, you define a test class extending TestCase, create test methods prefixed with 'test', and use PHPUnit assertions like assertEquals, assertTrue, and assertThrows. phpunit-skill streamlines this process by reducing boilerplate code and accelerating your test-driven development cycles, allowing you to focus on test logic rather than repetitive setup.
AI-generated summary based on this skill's SKILL.md
Decision gist · record as of 2026-07-24
phpunit-skill helps you write PHPUnit tests by automating test case generation, assertion setup, and lifecycle method configuration. To write tests, you define a test class extending TestCase, create test methods prefixed with 'test', and use PHPUnit assertions like assertEquals, assertTrue, and assertThrows. phpunit-skill streamlines this process by reducing boilerplate code and accelerating your test-driven development cycles, allowing you to focus on test logic rather than repetitive setup.
Use it when
- phpunit-skill assists with PHPUnit assertEquals examples by automating assertion setup within your test cases.
- phpunit-skill supports creating mock objects and test doubles through PHPUnit's mocking framework to isolate dependencies during testing.
Verify before relying
Read SKILL.md below before installing (3 files). Open directory: indexed for reading, not audited.
Install
LambdaTest/agent-skills/phpunit-skill · repository language: Python
Open directory. Skills are indexed for reading, not audited. Review a skill's body before installing it.
Frequently asked questions
AI-generated answers based on this skill's SKILL.md and metadata
How do I write PHPUnit tests for my PHP code?
phpunit-skill helps you write PHPUnit tests by automating test case generation, assertion setup, and lifecycle method configuration. To write tests, you define a test class extending TestCase, create test methods prefixed with 'test', and use PHPUnit assertions like assertEquals, assertTrue, and assertThrows. phpunit-skill streamlines this process by reducing boilerplate code and accelerating your test-driven development cycles, allowing you to focus on test logic rather than repetitive setup.
What is a PHPUnit assertEquals example and how does phpunit-skill help?
phpunit-skill assists with PHPUnit assertEquals examples by automating assertion setup within your test cases. The assertEquals method compares two values for equality—for instance, assertEquals(5, 2 + 3) verifies that an addition operation produces the expected result. phpunit-skill streamlines assertion configuration so you can quickly structure multiple assertions across your test suite without manual repetition, helping you build comprehensive test coverage faster.
How do I create mock objects and test doubles for dependency isolation in phpunit-skill?
phpunit-skill supports creating mock objects and test doubles through PHPUnit's mocking framework to isolate dependencies during testing. You can use createMock() or getMockBuilder() to generate mock instances of collaborating classes, then configure expectations and return values. phpunit-skill automates the setup of these mocks within your test structure, enabling you to verify that your code interacts correctly with dependencies without executing their actual implementations, which is essential for unit test isolation.
What are PHPUnit data providers and how does phpunit-skill use them?
phpunit-skill leverages PHPUnit data providers to set up data-driven tests that run the same test logic against multiple input datasets. A data provider is a method annotated with @dataProvider that returns arrays of test parameters. Rather than writing duplicate test methods, you define one test method and attach a data provider to execute it repeatedly with different inputs. phpunit-skill automates data provider configuration, allowing you to test edge cases and multiple scenarios efficiently without code duplication.
How does phpunit-skill handle PHPUnit project setup, CI/CD integration, and coverage reporting?
phpunit-skill configures PHPUnit project setup through phpunit.xml, which defines test directories, bootstrap files, and environment settings. For CI/CD integration, phpunit-skill helps you generate coverage reports in formats like Clover or HTML that integrate with continuous integration pipelines. You can configure coverage thresholds, specify which code paths to analyze, and automate test execution within your deployment workflow. phpunit-skill reduces configuration overhead so your testing infrastructure scales alongside your project.
How can phpunit-skill help me test exception handling and edge cases?
phpunit-skill assists with testing exception handling by automating the setup of test methods that verify your code throws expected exceptions under specific conditions. You use assertions like expectException() and expectExceptionMessage() to validate exception behavior. phpunit-skill structures these edge-case tests within your test suite, ensuring you cover error paths and boundary conditions. This capability helps you build resilient PHP code by confirming that exception handling logic works as designed across various failure scenarios.
SKILL.md
Rendered from the published skill. Quoted content, verbatim.
PHPUnit Testing Skill
Core Patterns
Basic Test
```php <?php use PHPUnit\Framework\TestCase;
class CalculatorTest extends TestCase { private Calculator $calculator;
protected function setUp(): void
{
$this->calculator = new Calculator();
}
public function testAddition(): void
{
$this->assertEquals(5, $this->calculator->add(2, 3));
}
public function testDivideByZero(): void
{
$this->expectException(\DivisionByZeroError::class);
$this->calculator->divide(10, 0);
}
public function testMultipleAssertions(): void
{
$this->assertSame(4, $this->calculator->add(2, 2));
$this->assertSame(0, $this->calculator->subtract(2, 2));
$this->assertSame(6, $this->calculator->multiply(2,
(truncated - see the full file via the links below)
File tree — 3 files
phpunit-skill/SKILL.md
phpunit-skill/reference/advanced-patterns.md
phpunit-skill/reference/playbook.md
Let your AI agent find skills like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 56,283 agent skills by what they can do, searchable in plain language.
wish › “Generate and structure PHPUnit test cases with assertions and lifecycle methods”
Give your agent the search over MCP, or paste the wish link into any chat. No install? Search from any chat →
Related skills
This skill enables you to create and run Behat behavior-driven development tests using Gherkin syntax, making it straightforward to validate PHP web application behavior through readable, executable specifications. Leverage structured scenario definitions to bridge the gap between business requirements and automated test coverage.
This skill enables you to generate Codeception acceptance tests using the Actor pattern and Cest format, streamlining test automation for web applications. It leverages TestMu AI's testing expertise to help you build robust, maintainable test suites that follow Codeception best practices.
PHP Pro is a senior-level specialist for modern PHP development with Laravel, Symfony, and PHP 8.3+. It enforces strict typing, dependency injection, and PSR compliance while generating typed DTOs, services, controllers, and comprehensive tests. Every implementation passes PHPStan level 9 and PHPUnit/Pest coverage thresholds before delivery.
This skill equips you to write robust JUnit 5 tests in Java, from basic assertions and exception handling to parameterized test cases and Mockito-driven mocking. It covers lifecycle management, nested test organization, and anti-patterns to avoid, with quick reference commands for Maven and Gradle execution.
This skill automates the creation of Flutter tests across widget and integration layers, helping you validate UI components and user workflows programmatically. It streamlines test generation for Flutter applications, reducing manual test writing overhead and improving coverage across your app's interactive surfaces.
Pest is a testing framework built on PHPUnit that replaces test classes with closures and assertion methods with a fluent expect() API. This skill covers test structure using test()/it()/describe(), the full expect() chain including modifiers and custom expectations, hooks for setup and teardown, datasets for parameterized testing, and advanced features like architecture rules and mutation testing.
More skills laravel-testing (MIT) · selenium-skill (MIT) · laravel-tdd (MIT) · laravel-dusk-skill (MIT) · Woocommerce Dev Cycle (unlicensed)