定制 abwebdevelopers/phpunit-presenter 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

abwebdevelopers/phpunit-presenter

Composer 安装命令:

composer require abwebdevelopers/phpunit-presenter

包简介

A presentable result printer for PHPUnit

README 文档

README

Displays the PHPUnit test results in a more presentable and friendly format. The Presenter includes timings for tests, colour support and better displays of errors and failures.

Presenter Output

This has only been tested with PHPUnit ^7.5. However, this plugin still allows PHPUnit up to ^9.0 (via composer.json) to ease dependency restrictions but please note that things may not work as expected (use at your own 'risk').

Features

  • Different formatting types depending on your preferences.
  • Grouping of test cases and suites.
  • Time taken for each test case.
  • Optional colour support.

How to use

Simply include this library via Composer:

composer require --dev abwebdevelopers/phpunit-presenter

And then add it to your phpunit.xml file as the printerClass attribute

<phpunit
        ...
        printerClass="ABWebDevelopers\PHPUnitPresenter\Presenter"
        ...
>

Configuration

The Presenter can be configured via environment variables. The following environment variables are used:

Environment Variable Default Description
PRESENTER_SHOW_TIMES 1 Displays the time taken for test cases. Set to 0 to disable.
PRESENTER_COLOURS 1 Displays colouring of CLI output. Set to 0 to disable. It is recommended to disable colours for test environments, ie. Travis CI.
PRESENTER_HIDE_SUCCESSFUL 0 If enabled, will hide all successful tests, and only show failed or errored tests. Set to 1 to enable.
PRESENTER_FORMAT default Sets the format used to display results via Presenter. Valid values are default, feed and condensed. It is recommended to use feed or condensed for test environments, ie. Travis CI.

Formats

There are three types of formatting of the results displayed by Presenter - default, feed and condensed.

default and feed display the same information (shown in the screenshot above), however, default uses CLI line overwriting to show real-time progress of tests. This may not work with some log readers used in test environments (such as Travis CI), so it is recommended to use feed for test environments.

A third format condensed presents test results in a condensed format closer to PHPUnit's default result printer. When using condensed, it is implied that PRESENTER_SHOW_TIMES is set to 0. The formatting of condensed looks similar to this:

Presenter Condensed Output

License

MIT.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-09-23

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固