Exemplo n.º 1
0
 /**
  * Sample Requests.
  *
  * <code>
  *  $options = [
  *      // set random paremeters.
  *      'min'           => int,
  *      'max'           => int,
  *      // flags to pass to enable.
  *      'enableFlags'   => int,
  *      // options to pass to enable.
  *      'enableOptions' => []
  *  ];
  *
  * @param ProfilerInterface $profiler
  * @param int               $min
  * @param int               $max
  * @param array             $options
  */
 public function __construct(ProfilerInterface $profiler, int $min = self::MIN, int $max = self::MAX, array $options = [])
 {
     $this->profiler = $profiler;
     if ($this->shouldRun($min, $max)) {
         $eFlags = array_key_exists('enableFlags', $options) ? $options['enableFlags'] : null;
         $eOptions = array_key_exists('enableOptions', $options) ? $options['enableOptions'] : [];
         $this->profiler->enable($eFlags, $eOptions);
         register_shutdown_function(function () use($profiler) {
             $profiler->disable();
             $profiler->save();
         });
     }
 }
Exemplo n.º 2
0
 /**
  * @covers Profiler::Save
  */
 public function testSave()
 {
     $this->assertTrue($this->profiler->save([]));
 }