- How do I use this test suite to validate spatie/laravel-jsonpath in my Laravel project?
- Add the test suite as a dev dependency via Composer, then configure PHPUnit to run its test cases against spatie/laravel-jsonpath’s parser. You can extend your Laravel test suite or run it in CI to gate PRs that modify JSONPath logic. The suite provides a shared benchmark for compliance.
- Can I integrate this test suite into Laravel’s Pest testing framework?
- Yes, the test suite is framework-agnostic. You can load its test cases in Pest by extending your test suite configuration or using Pest’s `extend()` method to include the compliance tests. Ensure PHPUnit is installed as a dev dependency for compatibility.
- Does this package work with Laravel 9+ and PHP 8.0+?
- The test suite requires PHP 8.0+ and has no Laravel-specific dependencies, so it’s compatible with Laravel 9+. However, it’s designed to test *other* JSONPath implementations (like spatie/laravel-jsonpath), not Laravel itself. Verify your target library’s Laravel version support separately.
- What if my custom JSONPath implementation intentionally deviates from the JSONPath draft?
- Document deviations explicitly and suppress or exclude the relevant tests in your test configuration. The suite is meant to enforce the draft, so intentional non-compliance should be handled via custom test overrides or annotations in your codebase.
- How can I run this test suite in CI without slowing down my pipeline?
- Run the test suite in parallel using PHPUnit’s `--parallel` flag or limit it to nightly builds. For critical paths, use CI environment variables to selectively enable compliance checks. Avoid running it on every PR unless absolutely necessary.
- Will this test suite break if the JSONPath Internet Draft updates?
- The test suite tracks the draft’s evolution, but updates may require re-validation of your implementation. Monitor the package’s changelog and treat compliance as a gated requirement in your `composer.json` scripts to catch breaking changes early.
- Can I use this to validate JSONPath queries in Laravel Eloquent or API responses?
- The test suite validates the *parser* itself, not specific queries or Laravel integrations. For Eloquent or API use cases, supplement with custom tests that mimic your application’s JSONPath patterns. The suite ensures the underlying parser behaves correctly, which indirectly benefits Laravel logic.
- Is there a performance impact if I run this in production?
- The test suite is not designed for runtime use—it’s a validation tool for development and CI. Running it in production would be unnecessary and could introduce overhead. Use it pre-deployment or in debug mode only if explicitly required for critical paths.
- Are there alternatives to this test suite for JSONPath compliance in Laravel?
- For Laravel-specific JSONPath needs, spatie/laravel-jsonpath includes basic tests, but this suite provides *standardized* compliance checks across languages. Other options include writing custom test cases or using language-agnostic tools like the [JSONPath Test Suite](https://github.com/json-path/JsonPath), though this package is more PHP-focused.
- How do I wrap a JSONPath parser (e.g., spatie/laravel-jsonpath) with compliance checks in Laravel?
- Create a decorator class that injects the test suite’s validation logic. For example, extend your parser with a `testCompliance()` method that runs the suite against it. Call this method during initialization or in a Laravel service container binding to fail fast if compliance is violated.