From woocommerce-commerce
Writes PHPUnit tests for PHP projects: unit tests, assertions, mocks, stubs, data providers, exception testing, TDD workflows. Supports WooCommerce via WC_Unit_Test_Case.
npx claudepluginhub orcaqubits/agentic-commerce-skills-plugins --plugin woocommerce-commerceThis skill is limited to using the following tools:
**Fetch live docs**: Web-search `site:phpunit.de documentation` for the latest PHPUnit documentation. Check `https://phpunit.de/` for current version and features.
Generates design tokens/docs from CSS/Tailwind/styled-components codebases, audits visual consistency across 10 dimensions, detects AI slop in UI.
Records polished WebM UI demo videos of web apps using Playwright with cursor overlay, natural pacing, and three-phase scripting. Activates for demo, walkthrough, screen recording, or tutorial requests.
Delivers idiomatic Kotlin patterns for null safety, immutability, sealed classes, coroutines, Flows, extensions, DSL builders, and Gradle DSL. Use when writing, reviewing, refactoring, or designing Kotlin code.
Fetch live docs: Web-search site:phpunit.de documentation for the latest PHPUnit documentation. Check https://phpunit.de/ for current version and features.
PHPUnit\Framework\TestCase (or WC_Unit_Test_Case for WooCommerce)test or annotated with #[Test]setUp() — runs before each testtearDown() — runs after each testsetUpBeforeClass() / tearDownAfterClass() — run once per classCore assertions:
assertEquals( $expected, $actual ) — loose equalityassertSame( $expected, $actual ) — strict identityassertTrue( $condition ) / assertFalse( $condition )assertNull( $value ) / assertNotNull( $value )assertCount( $expected, $array )assertContains( $needle, $haystack )assertInstanceOf( $class, $object )assertArrayHasKey( $key, $array )assertStringContainsString( $needle, $haystack )$this->expectException( InvalidArgumentException::class )$this->expectExceptionMessage( 'Expected message' )$this->expectExceptionCode( 404 )Create mock objects to verify interactions:
$mock = $this->createMock( PaymentProcessor::class );
$mock->expects( $this->once() )
->method( 'charge' )
->with( $this->equalTo( 29.99 ) )
->willReturn( true );
Return predetermined values without verifying calls:
$stub = $this->createStub( PriceCalculator::class );
$stub->method( 'calculate' )->willReturn( 29.99 );
$this->once() — called exactly once$this->exactly( $n ) — called exactly n times$this->never() — not called$this->atLeastOnce() — called one or more times$this->any() — any number of callswillReturn( $value ) — return fixed valuewillReturnMap( $map ) — return based on argumentswillReturnCallback( $callable ) — custom logicwillThrowException( $exception ) — throw on callSupply multiple test cases to a single test method:
public static function priceProvider(): array {
return [
'regular price' => [ 29.99, 29.99, '' ],
'sale price' => [ 29.99, 19.99, '19.99' ],
'zero price' => [ 0.00, 0.00, '' ],
];
}
#[DataProvider('priceProvider')]
public function test_get_display_price( float $regular, float $expected, string $sale ): void {
// test with each data set
}
#[DataProvider('methodName')] attribute$this->factory->post, $this->factory->usergo_to( $url ) — simulate page loadset_current_screen( 'edit-post' ) — simulate admin screenUse WP_Mock or Brain\Monkey libraries:
add_action, add_filter, do_action, apply_filterswp_remote_get, get_option, etc.Filter pre_http_request to intercept wp_remote_get() / wp_remote_post():
add_filter( 'pre_http_request', function( $preempt, $args, $url ) {
return [ 'response' => [ 'code' => 200 ], 'body' => '{"status":"ok"}' ];
}, 10, 3 );
tests/
├── bootstrap.php # Test bootstrap
├── Unit/ # Pure unit tests (no WP)
│ └── PriceCalculatorTest.php
├── Integration/ # Tests with WP/WC loaded
│ ├── ProductTest.php
│ └── OrderTest.php
└── E2E/ # Playwright end-to-end
└── specs/
unit, integrationtest_process_payment_returns_success_for_valid_cardFetch the PHPUnit documentation for exact assertion signatures, mock API, and configuration options before implementing.