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.
calmfox/watch-sylius
damienfern/grpc-symfony-bundle
atoolo/index-bundle
atoolo/genai-bundle
coprotoai/laravel-ticket
davidjln/llm-carbon-bundle
cryonighter/valid-request-bundle
coolms/taxonomy-bundle
coolms/field-bundle
articulate-orm/symfony
aaix/laravel-tall-architect
ephoto/akeneo-connector
emmanuelballery/eb-plantumlbundle
emielburgman/symfony-visitor-beacon
emielburgman/symfony-visit-storage
emielburgman/symfony-security-headers
emielburgman/symfony-log-viewer
emarref/xdebug-bundle
emarref/pubnub-bundle
elriseio/finance-money-bundle