mybuilder/phpunit-accelerator
最新稳定版本:2.0.0
Composer 安装命令:
composer require mybuilder/phpunit-accelerator
包简介
PHPUnit accelerator
README 文档
README
Inspired by Kris Wallsmith faster PHPUnit article, we've created a PHPUnit test listener that speeds up PHPUnit tests about 20% by freeing memory.
Installation
To install this library, run the command below and you will get the latest version
composer require mybuilder/phpunit-accelerator --dev
Usage
Just add to your phpunit.xml configuration
<phpunit> <listeners> <listener class="\MyBuilder\PhpunitAccelerator\TestListener"/> </listeners> </phpunit>
Ignoring Tests
Sometimes it is necessary to ignore specific tests, where freeing their properties is undesired. For this use case, you have the ability to extend the behaviour of the listener by implementing the IgnoreTestPolicy interface.
As an example, if we hypothetically wanted to ignore all tests which include "Legacy" in their test filename, we could create a custom ignore policy as follows
<?php use MyBuilder\PhpunitAccelerator\IgnoreTestPolicy; class IgnoreLegacyTestPolicy implements IgnoreTestPolicy { public function shouldIgnore(\ReflectionObject $testReflection) { return strpos($testReflection->getFilename(), 'Legacy') !== false; } }
And pass it to the constructor of our test listener in phpunit.xml configuration
<phpunit> <listeners> <listener class="\MyBuilder\PhpunitAccelerator\TestListener"> <arguments> <object class="\IgnoreLegacyTestPolicy"/> </arguments> </listener> </listeners> </phpunit>
Created by MyBuilder - Check out our blog for more insight into this and other open-source projects we release.
统计信息
- 总下载量: 2.96M
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 137
- 点击次数: 1
- 依赖项目数: 41
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2014-03-13