Author: Fabien Potencier (fabien@blackfire.io)
Inheritance: use trait Blackfire\Player\Extension\BlackfireStepTrait
 private function prepareRequest(Step $step, ValueBag $values, RequestInterface $request, $options)
 {
     $options['allow_redirects'] = false;
     if (!$step->getDelay()) {
         $options['delay'] = 0;
     } else {
         try {
             $options['delay'] = $this->language->evaluate($step->getDelay(), $values->all(true));
         } catch (ExpressionSyntaxError $e) {
             $msg = sprintf('Delay syntax error in "%s": %s', $step->getDelay(), $e->getMessage());
             $this->logger and $this->logger->critical($msg, ['request' => $request->getHeaderLine('X-Request-Id')]);
             throw new InvalidArgumentException($msg);
         }
     }
     unset($options['expectations']);
     if ($step->getExpectations()) {
         $options['expectations'] = $step->getExpectations();
     }
     unset($options['extractions']);
     if ($step->getExtractions()) {
         $options['extractions'] = $step->getExtractions();
     }
     foreach ($this->extensions as $extension) {
         $options = $extension->prepareRequest($step, $values, $request, $options);
     }
     return $options;
 }
Exemple #2
0
 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;
 }
Exemple #3
0
 private function fixUri(Step $step, $uri)
 {
     if (!$step->getEndpoint()) {
         return $uri;
     }
     return Psr7\Uri::resolve(Psr7\uri_for($step->getEndpoint()), $uri);
 }
Exemple #4
0
 private function prepareRequest(Step $step, $options)
 {
     $options['allow_redirects'] = false;
     unset($options['expectations']);
     if ($step->getExpectations()) {
         $options['expectations'] = $step->getExpectations();
     }
     unset($options['extractions']);
     if ($step->getExtractions()) {
         $options['extractions'] = $step->getExtractions();
     }
     foreach ($this->extensions as $extension) {
         $options = $extension->prepareRequest($step, $options);
     }
     return $options;
 }