コード例 #1
0
ファイル: IntegrationTest.php プロジェクト: kpocha/Sami
 /**
  * @group blackfire
  * @requires extension blackfire
  * @dataProvider getStorageData
  */
 public function testStorage($primedCache, $writeCalls, $readCalls)
 {
     $sami = $this->sami;
     if ($primedCache) {
         // prime the cache
         $sami['project']->parse();
     }
     $config = new Profile\Configuration();
     $config->defineMetric(new Profile\Metric('sami.storage.write_calls', array('=Sami\\Store\\JsonStore::writeClass')))->defineMetric(new Profile\Metric('sami.storage.read_calls', array('=Sami\\Reflection\\ClassReflection::fromArray')))->assert('metrics.sami.storage.write_calls.count == ' . $writeCalls, $writeCalls . ' write calls')->assert('metrics.sami.storage.read_calls.count <= ' . $readCalls, $readCalls . ' read calls');
     $profile = $this->getBlackfireClient()->assertPhpUnit($this, $config, function () use($sami) {
         $sami['project']->parse();
     });
 }
コード例 #2
0
ファイル: BlackfireExtension.php プロジェクト: stof/player
 private function createBlackfireConfig(Step $step, Build $build = null)
 {
     $config = new ProfileConfiguration();
     if (null !== $build) {
         $config->setBuild($build);
     }
     $config->setSamples($step->getSamples());
     $config->setTitle($step->getTitle());
     foreach ($step->getAssertions() as $assertion) {
         $config->assert($assertion);
     }
     return $config;
 }
コード例 #3
0
ファイル: Client.php プロジェクト: stof/php-sdk
 /**
  * Returns a profile request.
  *
  * Retrieve the X-Blackfire-Query value with Request::getToken().
  *
  * @param Profile\Configuration|string $config The profile title or a Configuration instance
  *
  * @return Request
  */
 public function createRequest($config = null)
 {
     if (is_string($config)) {
         $cfg = new Profile\Configuration();
         $config = $cfg->setTitle($config);
     } elseif (null === $config) {
         $config = new Profile\Configuration();
     } elseif (!$config instanceof Profile\Configuration) {
         throw new \InvalidArgumentException(sprintf('The "%s" method takes a string or a Profile\\Configuration instance.', __METHOD__));
     }
     return $this->doCreateRequest($config);
 }