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

Phpspec Skip Example Extension Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Getting Started

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.

Implementation Patterns

  • Conditional Spec Execution: Apply @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).
  • Spec Organization: Use in test suites for optional integrations (e.g., Doctrine DBAL drivers, cache adapters) to prevent noise in CI when a given dependency is not installed.
  • Continuous Workflow Integration: Combine with 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.
  • Extensibility Hook: Though not officially documented beyond @require, future extensions could leverage similar annotation parsing—code relies on Akeneo\SkipExampleExtension namespace, suggesting backward-compatible expansion paths.

Gotchas and Tips

  • Namespace Trap: The extension is enabled using Akeneo\SkipExampleExtension, not GrahamCampbell\… — double-check phpspec.yml to avoid silent no-op.
  • Class Existence Only: @require only checks if the class/interface exists; it does not verify version, trait availability, or runtime capabilities. Add runtime guards separately if needed.
  • Silent Skipping: Skipped specs show as 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).
  • Version Warning: Last updated in 2021; verify compatibility with newer PhpSpec versions (tested with PhpSpec ≤ 7.x, notPhpSpec 8+). Consider pinning versions in CI.
  • Local Debugging: If specs aren’t skipping as expected, run 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.
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.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport