flying-anvil/punit-tools 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

flying-anvil/punit-tools

最新稳定版本:0.1.4

Composer 安装命令:

composer require flying-anvil/punit-tools

包简介

Extensions for PHPUnit

README 文档

README

Extensions for PHPUnit

Installation

composer require --dev flying-anvil/punit-tools

Features

FeatureDescription
SlowTestReportKeeps track how long a test takes and gives a report of the slowest ones<br/>You can define thresholds for slow tests, either globally, for a whole test-class or a single test method

Slow Test

Configuration

<extensions>
  <extension class="\FlyingAnvil\PunitTools\SlowTestReport">
    <arguments>
      <!-- default threshold (in ms) -->
      <integer>100</integer>
      <!-- report length -->
      <integer>10</integer>
      <!-- report formatter (default | FQCN) -->
      <string>default</string>
      <array>
        <element key="useColors">
          <string>auto</string> <!-- always | never | auto -->
        </element>
      </array>
    </arguments>
  </extension>
</extensions>

Report Formatter

You can define a custom report formatter by specifying its FQCN. It must implement \FlyingAnvil\PunitTools\SlowTest\ReportFormatter\ReportFormatterInterface and must be instantiable via new without parameters.

Colors

When using auto, colors are used if running in an interactive session, and if piping the output or when running tests automated they are not used.

SlowThreshold Attribute

Use this attribute to overwrite the threshold for a single test or test class. Its value is the new threshold in ms.

#[SlowThreshold(1100)]
public function testThatIsExpectedToBeSlow(): void
{
    sleep(1);
}

统计信息

  • 总下载量: 4.02k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-01-14