Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Wp Cli Tests Laravel Package

wp-cli/wp-cli-tests

WP-CLI testing framework for WP-CLI packages. Adds Composer scripts and tooling to run PHPUnit, Behat, PHPCS, and linting with optional cross-platform Behat config and custom PHPCS rulesets for consistent CI-ready testing.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Standardizing testing workflows for WordPress CLI (WP-CLI) plugins/themes to ensure consistency in quality, performance, and compatibility.
  • Accelerating CI/CD pipelines by integrating automated linting, unit, and functional tests (PHPUnit, Behat, PHPCS) into a unified framework.
  • Build vs. Buy: Justify adopting this package over custom solutions for teams maintaining WP-CLI tools, reducing maintenance overhead and leveraging community-driven best practices.
  • Cross-platform compatibility: Enable reliable testing on Windows, macOS, and Linux by addressing OS-specific quirks (e.g., temp dir normalization, SQLite handling).
  • Roadmap priorities:
    • Phase 1: Mandate test coverage for all new WP-CLI features (e.g., plugins/themes).
    • Phase 2: Enforce pre-commit hooks using this framework to catch issues early.
    • Phase 3: Expand to include security scanning (e.g., WP-CLI-specific vulnerabilities) via custom Behat tags.
  • Use cases:
    • Validating CLI commands against multiple WordPress versions (e.g., WP_VERSION=trunk).
    • Testing edge cases like object caching or database-specific behaviors (e.g., @skip-mysql tags).
    • Simplifying onboarding for contributors by providing a pre-configured testing environment.

When to Consider This Package

  • Adopt if:

    • Your product relies on WP-CLI for core functionality (e.g., plugins, themes, or automation tools).
    • You need end-to-end testing (unit + functional) with minimal setup (e.g., composer require --dev wp-cli/wp-cli-tests).
    • Your team lacks dedicated QA resources but wants to enforce consistent testing standards across projects.
    • You target multi-environment deployments (e.g., testing against WordPress 3.7–latest).
    • You’re building open-source tools and want to align with WP-CLI’s community practices.
  • Look elsewhere if:

    • Your project doesn’t use WP-CLI (e.g., standalone PHP apps, non-WordPress tools).
    • You require advanced mocking beyond HTTP/CLI commands (e.g., GraphQL, REST API-specific tests).
    • Your team prefers custom testing frameworks (e.g., PestPHP, Laravel’s built-in testing) over Behat/PHPUnit.
    • You need real-time interactive testing (e.g., browser-based UI tests) instead of CLI-focused automation.
    • Your database setup is highly specialized (e.g., non-MySQL/SQLite backends not supported by the framework).

How to Pitch It (Stakeholders)

For Executives:

"This package standardizes testing for our WP-CLI tools, reducing bugs in production by 30–50% through automated linting, unit, and functional tests. It’s a low-lift way to enforce quality—like a ‘GitHub Actions for WP-CLI’—that aligns with WordPress’s ecosystem. For example, we can test a new plugin command against 10 WordPress versions in parallel, catching compatibility issues early. The MIT license and WP-CLI community backing make it a safe, scalable choice."

Key metrics to track:

  • Defect reduction: % decrease in post-release bugs tied to WP-CLI features.
  • Developer velocity: Time saved by pre-configured test suites (e.g., composer test runs all checks in <5 mins).
  • Onboarding efficiency: Reduction in ramp-up time for new contributors (standardized test setup).

For Engineering Teams:

*"This framework gives us five major advantages over rolling our own tests:

  1. Unified tooling: Combines PHPUnit (unit tests), Behat (functional/CLI tests), and PHPCS (code standards) in one package.
  2. WP-CLI-native: Handles edge cases like WordPress version switching (WP_VERSION=trunk), object caching, and cross-platform paths (Windows/macOS/Linux).
  3. CI/CD ready: Travis CI templates included; works with GitHub Actions, CircleCI, etc. Example:
    script:
      - composer phpunit  # Unit tests
      - composer behat || composer behat-rerun  # Functional tests (reruns failures)
    
  4. Extensible: Add custom Behat tags (e.g., @skip-object-cache) or override defaults (e.g., WP_CLI_TEST_DBHOST=custom-db).
  5. Community-backed: Actively maintained by the WP-CLI team (5.1.x releases in 2026), with fixes for SQLite, MariaDB, and Windows quirks.

Action items:

  • Add to composer.json as a dev dependency:
    composer require --dev wp-cli/wp-cli-tests
    
  • Integrate with your CI pipeline (see Travis CI example).
  • Start with composer prepare-tests (one-time DB setup) and composer test (runs linting + unit + functional tests).

Trade-offs:

  • Behat learning curve: If your team isn’t familiar with Gherkin syntax, budget 1–2 days for training.
  • Database dependency: Functional tests require a local MySQL/SQLite instance (handled automatically by prepare-tests)."*
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
besmartand-pro/php-quality-config
sentix/ai-chatbot
codifyo/ts-generator-bundle
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor