定制 jclaveau/phpunit-profile-asserts 二次开发

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

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

jclaveau/phpunit-profile-asserts

Composer 安装命令:

composer require jclaveau/phpunit-profile-asserts

包简介

Provides asserts against memory usage and execution time for PHPUnit

README 文档

README

This lib provides asserts against execution time and memory usage. It also provides a StopwatchListener based on the Stopwatch component of Symfony.

Tests

Installation

phpunit-profile-asserts is installable via Composer and should be added as a require-dev dependency:

composer require --dev jclaveau/phpunit-profile-asserts

Usage

Enable by adding the following code to your project's phpunit.xml file:

<phpunit bootstrap="vendor/autoload.php">
...
    <listeners>
        <listener class="JClaveau\PHPUnit\Listener\StopwatchListener" />
    </listeners>
</phpunit>
class SomeTestCase extends \PHPUnit_Framework_TestCase
{
    use \JClaveau\PHPUnit\Framework\UsageConstraintTrait; // adds the asserts methods

    /**
     */
    public function test_usages()
    {
        // ...

        $this->assertExecutionTimeBelow(1.5); // seconds
        $this->assertMemoryUsageBelow('1M');

        // This trait also provides two methods to help knowing the current
        // memory usage and duration
        $this->getMemoryUsage();
        $this->getExecutionTime();
    }

}

TODO

  • Integrate SpeedTrap and adds MemoryTrap
  • Investigate xhprof integration and asserts on number of calls / execution time of specific methods/functions

Inspiration

License

phpunit-profile-asserts is available under the MIT License.

统计信息

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

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-07-13

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固