friends-of-phpspec/phpspec-requires

此包已被 弃用 且不再维护。未建议替代包。

PHPSpec 扩展,允许您使用 @requires 注解。

1.1.4 2019-12-28 10:48 UTC

This package is auto-updated.

Last update: 2022-03-21 10:51:58 UTC


README

Latest Stable Version GitHub stars Total Downloads GitHub Workflow Status License

PHPSpec requires 扩展

一个 PHPSpec 扩展,允许您使用 @requires 注解。

安装

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

使用

phpspec.yml(或 phpspec.yml.dist)文件中启用扩展

extensions:
  FriendsOfPhpspec\PhpspecRequires\PhpspecRequires: ~

然后,您可以在 spec 方法的文档块中使用注解 @requires

/**
 * @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
}

待办事项

  • 测试

贡献

请参阅文件 CONTRIBUTING.md,但请随意通过发送 Github pull requests 来为此库做出贡献。