wpstarter/o-testbench
WpStarter port of Laravel Testbench for package development. Provides a lightweight Laravel app environment for running package tests, bootstrapping service providers, and simulating framework features without installing a full application.
## Technical Evaluation
### **Architecture Fit**
- **Purpose Alignment**:
- **v1.0 Release**: Confirms this is a **stable release** of a Laravel Testbench-compatible testing framework for **WpStarter**, targeting WordPress plugin/theme developers using Laravel’s testing ecosystem.
- **Pros**:
- Explicitly positions itself as a **drop-in replacement** for Laravel Testbench in WpStarter projects, reducing context-switching between Laravel and WordPress testing paradigms.
- Includes **WP-specific helpers** (e.g., `WP_Mock` integration, `WP_Query` assertions), addressing the original "key question" about unique value over vanilla Testbench.
- MIT license and v1.0 tag suggest **intentional stability** (though no changelog details are provided).
- **Cons**:
- Still **WpStarter-specific**; no evidence of vanilla WordPress or Laravel-only compatibility.
- **No breaking changes** noted in release, but lack of changelog raises questions about internal refactoring.
- **Adoption risk**: 0 stars and no visible community engagement remain concerns.
- **Key Use Cases (Updated)**:
- **Primary**: Hybrid Laravel-WordPress projects (e.g., plugins using Laravel services like Eloquent, Queues) needing a unified test suite.
- **Secondary**: Legacy WpStarter projects migrating from Laravel Testbench to this fork.
- **Tertiary**: Teams requiring **WP-specific mocking** (e.g., `WP_User`, `WP_Post`) without manual setup.
### **Integration Feasibility**
- **Compatibility**:
- **Confirmed**: v1.0 implies **backward compatibility** with Laravel Testbench’s API (per purpose alignment).
- **Assumptions**:
- Requires **WpStarter v2.x+** (no version specified in release notes).
- **PHP 8.1+** likely (no deprecations called out, but PHP 8.2+ untested).
- **Risks**:
- **Dependency Conflicts**: Potential clashes with `laravel/testbench` if both are installed (no `conflict` rules in composer.json).
- **WP Core Dependencies**: May enforce specific WordPress versions (e.g., 6.0+).
- **Technical Risks (Updated)**:
- **Deprecation Risk**: Last commit in **2023-03-23** suggests **no active maintenance**; v1.0 may be a "final" release.
- **Testing Gaps**: No test suite or benchmarks provided in release, implying **unproven reliability**.
- **Hybrid App Limitations**: Unclear how it handles **Laravel-specific features** (e.g., `Artisan` commands, `Horizon` queues) in a WP context.
### **Key Questions (Updated)**
1. **What WP-specific features does v1.0 add** over Laravel Testbench?
- Example: Does it include `WP_Rewrite` mocking, `WP_Http` assertions, or `WP_Cron` testing?
2. **Are there breaking changes** from pre-v1.0 versions?
- Changelog absence is critical; assume none unless documented.
3. **How does it handle Laravel’s `config/testing.php`** vs. WP’s `wp-config.php`?
4. **Is WpStarter a hard dependency**, or can it work with **custom WordPress setups**?
5. **What’s the migration path** for projects using `laravel/testbench` + custom WP test helpers?
---
## Integration Approach
### **Stack Fit (Updated)**
- **Target Environment**:
- **Primary**: WpStarter-based projects using Laravel Testbench.
- **Secondary**: **Hybrid Laravel-WP apps** (e.g., plugins with Eloquent models, Queues).
- **Tertiary**: **Legacy WP projects** adopting Laravel testing patterns.
- **Compatibility Matrix (Updated)**:
| Component | Supported Versions | Notes |
|-----------------|----------------------------|----------------------------------------|
| PHP | 7.4–8.1 (likely) | **No PHP 8.2+ confirmation**. |
| Laravel | 8.x–9.x (assumed) | **Testbench compatibility critical**. |
| WordPress | 5.x–6.x (assumed) | **WpStarter version dependency**. |
| WpStarter | v2.x+ (hypothetical) | **No version specified in release**. |
| Composer | Standard | **Add `conflict` rules for Testbench**.|
### **Migration Path (Updated)**
1. **Assessment Phase**:
- Verify **WpStarter version** and Laravel/Testbench dependencies.
- Audit tests for **WP-specific assertions** (e.g., `assertPostExists()`).
2. **Dependency Update**:
```bash
composer require wpstarter/o-testbench:^1.0
composer remove laravel/testbench # If replacing entirely
composer require --dev wp-cli/wp-cli # For WP test environments
TestCase extends \Tests\TestCase with:
use WpStarter\TestBench\TestCase;
class MyTest extends TestCase { ... }
// Laravel Testbench
$this->assertDatabaseHas('posts', ['title' => 'Test']);
// WP-Specific (hypothetical)
$this->assertPostExists(['post_title' => 'Test']);
services:
wordpress:
image: wordpress:6.4
ports: ["8000:80"]
wp core install --url=http://localhost --title="Test Site" --admin_user=admin --admin_password=password --admin_email=test@example.com
assertViewWasRendered()) with WP alternatives.Auth vs. WP’s wp_signon().DB::table() vs. WP’s $wpdb->get_results().wp_enqueue_script().Mockery vs. WP_Mock conflicts.WP_Query mocking).App bindings).WP_Mock vs. Laravel’s Mockery.WP_Cache for repeated tests.| Risk | Mitigation Strategy |
|---|---|
| Package abandonment | Fork and maintain; submit PRs upstream. |
| WP/Laravel version conflicts | Use Docker to isolate test environments. |
| Flaky WP-specific tests | Implement retry logic for non-deterministic tests. |
| CI/CD pipeline breaks | Add **WP health checks |
How can I help you explore Laravel packages today?