wpstarter/o-testbench-core
Core utilities for running WordPress-focused package tests with an Orchestra Testbench-style setup. Provides shared bootstrapping, environment config, and helpers to spin up a predictable app/testing container for faster, repeatable test suites.
Purpose Alignment:
The package remains a WordPress-specific fork of orchestra/testbench-core, explicitly designed for PHPUnit-based testing of WordPress plugins/themes. Its v1.0 release does not introduce Laravel-specific functionality, reinforcing that it is not a Laravel-first solution. For Laravel applications, this package is only relevant if there is a direct integration with WordPress (e.g., REST API calls, shared database models, or hybrid architectures). For pure Laravel testing, native Laravel tools (phpunit, testbench) remain the idiomatic choice.
Core Functionality: The release notes do not indicate new Laravel-compatible features, but rather WordPress-specific improvements (e.g., better WP environment bootstrapping, plugin/theme testing utilities). Key additions in v1.0 likely include:
wp-cli integration, better database isolation).create_post(), activate_plugin()).Key Use Cases (Unchanged):
laravel/testbench or Pest instead).Laravel Compatibility: Still low. The package is not designed for Laravel and does not address Laravel’s testing paradigms (e.g., dependency injection, Artisan commands). However, v1.0 may improve WP environment stability, making it slightly more viable for hybrid projects if:
wp_users table).Technical Debt:
orchestra/testbench-core, and no upstream maintenance is evident.Alternatives (Reiterated):
WP_Mock or wp-cli + PHPUnit directly.Fork Risks (Updated):
Complexity Overhead:
New Risks in v1.0:
orchestra/testbench-core? (Risk of technical debt.)WP_Mock) achieve the same goals with less risk?Target Use Case (Unchanged):
Non-Target Use Case (Reiterated):
laravel/testbench or Pest instead.Stack Compatibility (Updated):
composer require wpstarter/o-testbench-core.Assess Scope (Reiterated):
Pilot Integration (Updated):
WP_Mock + Laravel HTTP tests for simpler setups.CI/CD Setup (Updated):
composer require wpstarter/o-testbench-core --dev
./vendor/bin/phpunit --testdox-html --filter TestLaravelWPIntegration
Gradual Adoption (Reiterated):
Pros (Reiterated):
create_user(), activate_plugin()).Cons (Reiterated):
wp_db vs. Laravel’s migrations).Phase 1: Define Test Boundaries (Reiterated):
testbench) from WP-dependent tests (this package).Phase 2: Infrastructure Setup (Updated):
docker-compose.yml (unchanged but may benefit from v1.0):
services:
laravel:
build: ./laravel
wordpress:
image: wordpress:6.4
volumes:
- ./wp-content:/var/www/html/wp-content
Phase 3: Write Hybrid Tests (Updated):
use WPStarter\TestBench\TestCase;
class WPIntegrationTest extends TestCase {
public function test_laravel_calls_wp_rest_api() {
$response = $this->get('/api/content');
$this->assertEquals(200, $response->status());
// Assert WP data is included...
}
}
Phase 4: CI/CD Integration (Reiterated):
orchestra/testbench-core for breaking changes.How can I help you explore Laravel packages today?