pw-test
Use when creating, executing, or managing Pest tests within ProcessWire or ProcessWire modules, including Test-Driven Development (TDD) tasks.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when creating, executing, or managing Pest tests within ProcessWire or ProcessWire modules, including Test-Driven Development (TDD) tasks.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Use when building, structuring, or refactoring native backend modules for ProcessWire using PHP 8.4 and strict typing.
Use when designing, structuring, or rendering HTML for ProcessWire Admin interfaces, custom Process modules, or Inputfields.
Use when brainstorming or designing ProcessWire modules, templates, field schemas, or hooks to resolve ambiguity and validate architecture before implementation.
Use when encountering any bug, test failure, blank screen of death, or unexpected behavior in ProcessWire before proposing fixes.
Use when creating or updating module documentation, package READMEs, architecture guides, or CLI command references for ProcessWire projects.
Use when creating implementation plans from approved specifications to ensure ProcessWire-native architecture, safe migration structures, and strict test-driven task execution.
| name | pw-test |
| description | Use when creating, executing, or managing Pest tests within ProcessWire or ProcessWire modules, including Test-Driven Development (TDD) tasks. |
| risk | safe |
| source | processwire-boost |
wire test.ProcessWire Console uses Pest PHP coupled with a powerful FeatureDiscoverer. This means tests are decentralized across the CMS but executed globally.
Tests automatically execute if placed in one of three locations:
/tests/: Root-level generic tests./site/tests/: Project-specific or integration tests.
When you run php vendor/bin/wire test, the console discovers all active test folders and runs Pest across them simultaneously.When Pest is first initialized via wire test, the test engine automatically appends logic to /tests/Pest.php to boot ProcessWire:
if (!class_exists('\\ProcessWire\\ProcessWire')) {
require_once dirname(__DIR__) . '/index.php';
}
This is critical: It exposes the full wire() API, $pages, $sanitizer, and global state to the isolated Pest test process. You do not need to manually boot ProcessWire in your test files.
Never create test files manually. Always use the scaffolding commands to ensure naming and path conventions are correct:
# Create a standard Feature test in the root site/tests/Feature/
php vendor/bin/wire make:test AuthFlowTest
# Create a Unit test in site/tests/Unit/
php vendor/bin/wire make:test UserParser --unit
# Scope the test specifically to a module
php vendor/bin/wire make:test ApiConnector --module=MyCustomApi
Execute the tests directly using the console wrapper. Any native Pest arguments can be forwarded.
# Run all tests
php vendor/bin/wire test
# Run and filter by class or description
php vendor/bin/wire test --filter=AuthFlowTest
# Parallel execution
php vendor/bin/wire test --parallel
Always use Pest's native functional API.
<?php
// site/modules/MyModule/tests/Feature/ExampleTest.php
declare(strict_types=1);
test('module handles sanitization correctly', function () {
$sanitizer = \ProcessWire\wire('sanitizer');
$clean = $sanitizer->text("<h1>Hello</h1>");
expect($clean)->toBe('Hello');
});
pest.stub standardization and directory routing built into make:test../vendor/bin/pest directly if testing multi-module structures. Rationalization: "It's the standard Pest way." Counter: ProcessWire separates test files via FeatureDiscoverer. Using pest directly will only test the root /tests folder and will ignore active ProcessWire modules! Always use php vendor/bin/wire test.composer.json to load module tests via PSR-4. Rationalization: "PHPUnit needs autoloading for test classes." Counter: Pest does not require structural PSR-4 routing for simple closures, and the TestCommand explicitly passes module directories at execution time.RefreshDatabase trait, HTTP assertions like $this->get()). Rationalization: "Pest is usually used with Laravel." Counter: This is ProcessWire. Use native $pages->find(), $wire->input, etc.pw-module-development: Guidelines for building the actual modules you are testing.pw-systematic-debugging: Approaches for isolating code errors when tests fail.