Skip to content
This repository has been archived by the owner on Mar 21, 2022. It is now read-only.

PHPSpec 5 extension that allows you to use the @requires annotation.

Notifications You must be signed in to change notification settings

friends-of-phpspec/phpspec-requires

Repository files navigation

Latest Stable Version GitHub stars Total Downloads GitHub Workflow Status License

PHPSpec requires extension

A PHPSpec extension that allows you to use the annotation @requires.

Installation

composer require friends-of-phpspec/phpspec-requires --dev

Usage

Enable extension in phpspec.yml (or phpspec.yml.dist) file:

extensions:
  FriendsOfPhpspec\PhpspecRequires\PhpspecRequires: ~

Then, you can use the annotation @requires in the documentation block of your spec methods.

/**
 * @requires OS Windows
 */
public function it_will_be_tested_on_windows_operating_system_only() {
  // test code here
}

/**
 * @requires OSFAMILY bsd
 */
public function it_will_be_tested_on_bsd_operating_system_family() {
  // test code here
}

/**
 * @requires function customFunction
 */
public function it_will_be_tested_only_if_the_function_is_found() {
  // test code here
}

/**
 * @requires extension mysqli
 */
public function it_will_be_tested_only_if_extension_is_found() {
  // test code here
}

/**
 * @requires PHP 7.3
 */
public function it_will_be_tested_only_if_php_version_is_equal_or_greater() {
  // test code here
}

Todo

  • Tests

Contributing

See the file CONTRIBUTING.md but feel free to contribute to this library by sending Github pull requests.

About

PHPSpec 5 extension that allows you to use the @requires annotation.

Resources

Code of conduct

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Languages