lloople/phpunit-extensions
Composer 安装命令:
composer require lloople/phpunit-extensions
包简介
📦 Some cool extensions for PHPUnit
README 文档
README
This package provides you a few useful extensions for your testsuite in an effort to improve your code.
Installation
You can install the package via composer:
composer require lloople/phpunit-extensions --dev
Add the Extension to your phpunit.xml file:
<extensions> <extension class="Lloople\PHPUnitExtensions\Runners\SlowestTests\Console" /> </extensions>
Extensions
Console
Output the slowest tests on the console.
<extension class="Lloople\PHPUnitExtensions\Runners\SlowestTests\Console"/>
Showing the top 5 slowest tests:
543 ms: Tests\Feature\ProfileTest::can_upload_new_profile_image
26 ms: Tests\Feature\ProfileTest::can_visit_profile_page
25 ms: Tests\Feature\ProfileTest::throws_validation_error_if_password_not_match
Default options are:
- rows:
5(Report 5 tests max) - min:
200(Report tests slower than 200ms)
Csv
Write the tests in a CSV file ready for import.
<extension class="Lloople\PHPUnitExtensions\Runners\SlowestTests\Csv"/>
Default options are:
- file:
phpunit_results.csv - rows:
null(all the tests) - min:
200
Json
Write the tests in a JSON file ready for import.
<extension class="Lloople\PHPUnitExtensions\Runners\SlowestTests\Json"/>
Default options are:
- file:
phpunit_results.json - rows:
null(all the tests) - min:
200
MySQL
Store the test name and the time into a MySQL database. It will override existing records
<extension class="Lloople\PHPUnitExtensions\Runners\SlowestTests\MySQL"/>
Default credentials are (as array):
- database:
phpunit_results - table:
default - username:
root - password: ``
- host:
127.0.0.1 - rows:
null(all the tests) - min:
200
SQLite
Store the test name and the time into a SQLite database. It will override existing records
<extension class="Lloople\PHPUnitExtensions\Runners\SlowestTests\SQLite"/>
Default credentials are (as array):
- database:
phpunit_results.db - table:
default - rows:
null(all the tests) - min:
200
Arguments
To override the default configuration per extension, you need to use <arguments>in your phpunit.xml file
<extension class="Lloople\PHPUnitExtensions\Runners\SlowestTests\Json"> <arguments> <string>phpunit_results_as_json.json</string> <integer>10</integer> <!-- Max number of tests to report. --> <integer>400</integer> <!-- Min miliseconds to report a test. --> </arguments> </extension>
In the case of the MySQL and SQLite, which needs a database connection, configuration goes as array
<extension class="Lloople\PHPUnitExtensions\Runners\SlowestTests\MySQL"> <arguments> <array> <element key="database"> <string>my_phpunit_results</string> </element> <element key="table"> <string>project1_test_results</string> </element> <element key="username"> <string>homestead</string> </element> <element key="password"> <string>secret</string> </element> <element key="host"> <string>192.168.12.14</string> </element> </array> </arguments> </extension>
You don't need to override those credentials that already fit to your usecase, since the class will merge your configuration with the default one
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email d.lloople@icloud.com instead of using the issue tracker.
Credits
Treeware
You're free to use this package, but if it is really useful for you I would highly appreciate you buying the world a tree.
It’s now common knowledge that one of the best tools to tackle the climate crisis and keep our temperatures from rising above 1.5C is to plant trees. If you contribute to Treeware's forest you’ll be creating employment for local families and restoring wildlife habitats.
You can buy trees here offset.earth/treeware
Read more about Treeware at treeware.earth
lloople/phpunit-extensions 适用场景与选型建议
lloople/phpunit-extensions 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 188.18k 次下载、GitHub Stars 达 38, 最近一次更新时间为 2020 年 01 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「lloople」 「phpunit-extensions」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 lloople/phpunit-extensions 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 lloople/phpunit-extensions 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 lloople/phpunit-extensions 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
统计信息
- 总下载量: 188.18k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 38
- 点击次数: 11
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-01-04