babdev / phpspec-skip-example-extension
Skip your PhpSpec examples through annotations
Installs: 227
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 9
Open Issues: 0
Type:phpspec-extension
Requires
- php: ^7.4 || ^8.0
- phpspec/phpspec: ^7.0
README
This PhpSpec extension allows to skip example through user-friendly annotations.
Installation
Once you have installed PhpSpec (following the documentation on the official website), you can install this extension using the following Composer command:
composer require babdev/phpspec-skip-example-extension
Configuration
You can now activate the extension by creating a phpspec.yml
file at the root of your project:
extensions: Akeneo\SkipExampleExtension: ~
Usage
@require
The @require
annotation can be used on the spec class or any example method. If a requirement is missing from the spec, all examples will be skipped. If a requirement is missing from an example, only that example will be skipped.
/** * @require Vendor\Builder\ToolInterface */ class BridgeBuilderSpec extends ObjectBehavior { // Will be skipped if the Vendor\Builder\ToolInterface interface does not exist function it_builds_a_bridge() { } /** * @require Vendor\Builder\ConcreteTruck */ // Will be skipped if the Vendor\Builder\ToolInterface interface or Vendor\Builder\ConcreteTruck class does not exist function it_builds_the_road() { } //... }
Contributions
Feel free to contribute to this extension if you find some interesting ways to improve it!