Example #1
0
 public function testResolve()
 {
     $this->profiler->start('foo', 'barbar');
     $this->profiler->stop('foo');
     $this->profiler->monitor('Foobar', function () {
         // yeah
     });
     $this->assertInstanceOf(\Generator::class, $this->datasource->getProcess($this->process->getId()));
 }
Example #2
0
 public function testSaveSummary()
 {
     $process = Process::build();
     $this->datasource->saveSummary($process, ['foo' => 'bar']);
     $profiles = $this->datasource->all();
     $this->assertEquals(1, count($profiles));
     $profile = current($profiles);
     $this->assertObjectHasAttribute('foo', $profile);
     $this->assertEquals('bar', $profile->foo);
 }
Example #3
0
 /**
  * Convert data into jsonpatch query and save it in the data source
  * @return mixed
  */
 public function persist()
 {
     $this->validate();
     if (!is_array($this->data)) {
         $this->data = [$this->data];
     }
     $append = $this instanceof StreamCollectorInterface;
     $patches = $this->jsonPatch->generateArrayAdd($this->getPath(), $this->data, $append);
     $this->dataSource->save($this->process, $patches);
     $this->data = [];
 }
Example #4
0
 public function testResolveMonolog()
 {
     $monolog = new Monolog();
     $log = new Logger('name');
     $log->pushHandler($monolog);
     $monolog->setDispatcher($this->process->getDispatcher());
     $this->profiler->setLogger($monolog);
     $log->addError('Bar');
     $this->profiler->alert('FooBar');
     $this->assertInstanceOf(\Generator::class, $this->datasource->getProcess($this->process->getId()));
 }
Example #5
0
 public function testPersist()
 {
     $this->collector->resolve();
     $this->collector->persist();
     $this->assertInstanceOf(\Generator::class, $this->datasource->getProcess($this->process->getId()));
 }
Example #6
0
 /**
  * @param $id
  * @return mixed
  */
 public function getProfile($id)
 {
     return (new JsonPatch())->compile($this->datasource->getProcess($id));
 }
Example #7
0
 public function testSaveSummary()
 {
     $process = Process::build();
     $this->datasource->saveSummary($process, ['foo' => 'bar']);
     $this->assertEquals(0, $this->datasource->count());
 }