graham-campbell/phpspec-skip-example-extension
PhpSpec extension that lets you skip spec examples via simple annotations. Add @require ClassOrInterface to skip all examples in a spec when a dependency isn’t available. Install with Composer and enable in phpspec.yml.
Install the package with Composer:
composer require --dev graham-campbell/phpspec-skip-example-extension:^5.1
Then enable it in phpspec.yml at your project root:
extensions:
Akeneo\SkipExampleExtension: ~
Begin using @require annotations in your spec classes to conditionally skip entire specs when dependencies (classes/interfaces) are missing — especially useful in polyfills, optional bridges, or multi-version compatibility suites.
@require Some\Class or @require SomeInterface at the class level to skip the entire spec if the dependency is unavailable. This avoids test failures in environments lacking optional components (e.g., Laravel vs Symfony bridges).phpspec run --format progress to get clear skip indicators (e.g., S for skipped) without breaking the build pipeline. Ideal in monorepos where different components are tested conditionally.@require, future extensions could leverage similar annotation parsing—code relies on Akeneo\SkipExampleExtension namespace, suggesting backward-compatible expansion paths.Akeneo\SkipExampleExtension, not GrahamCampbell\… — double-check phpspec.yml to avoid silent no-op.@require only checks if the class/interface exists; it does not verify version, trait availability, or runtime capabilities. Add runtime guards separately if needed.S in default progress format, but may be missed in verbose outputs — run with --format pretty to see skip reasons (Skipped: requirement 'Foo\Bar' not satisfied).phpspec run --strict-exit-code and inspect the full output — PHP fatal errors (e.g., interface not found) will fail fast, bypassing the annotation. Ensure autoloading is correct before @require logic triggers.How can I help you explore Laravel packages today?