dawen/dic-service-benchmark-bundle

测试服务实例化时间。

安装量: 6,809

依赖者: 0

建议者: 0

安全: 0

星标: 1

关注者: 1

分支: 0

公开问题: 0

类型:symfony-bundle

0.2.0 2015-12-22 12:20 UTC

This package is not auto-updated.

Last update: 2024-09-14 17:58:48 UTC


README

此代码将实例化DIC中注册的每个服务并检查所花费的时间。

安装

在您的composer.json中需要dawen/dic-service-benchmark-bundle包并更新您的依赖项。

    $ composer require dawen/dic-service-benchmark-bundle

此包不包含运行时或任何服务的代码。您无需将其添加到您的AppKernel中。

用法

检查您的phpunit安装位置并运行 (提示:禁用此测试的覆盖率)

    bin/phpunit -c app vendor/dawen/dic-service-benchmark-bundle/Dawen/Bundle/DicServiceBenchmarkBundle/Tests/DicServiceBenchmarkTest.php

这将打印出一个服务列表以及它们实例化时花费的时间。如果服务花费的时间超过50ms,此测试将失败。

如果您想忽略服务ID,可以在您的phpunit.xml中添加一个全局war,其中包含所有以冒号分隔的服务ID。

  <php>
      <var name="dic-service-benchmark-ignore" value="web_profiler.controller.router,my-service"/>
  </php>