public function testGetProcess()
 {
     $profile = $this->datasource->getProcess('XXX');
     $this->assertInstanceOf(\Generator::class, $profile);
     $array = iterator_to_array($profile);
     $this->assertCount(1, $array);
 }
Beispiel #2
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()));
 }
Beispiel #3
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()));
 }
Beispiel #4
0
 public function testSave()
 {
     $process = Process::build();
     $this->datasource->save($process, ['foo' => 'bar']);
     $this->assertEquals(1, $this->datasource->count());
     $profile = $this->datasource->getProcess($process->getId());
     $this->assertInstanceOf(\Generator::class, $profile);
     $profile = json_decode(current(iterator_to_array($profile)));
     $this->assertInstanceOf(\stdClass::class, $profile);
     $this->assertObjectHasAttribute('foo', $profile);
     $this->assertEquals('bar', $profile->foo);
 }
Beispiel #5
0
 public function testPersist()
 {
     $this->collector->resolve();
     $this->collector->persist();
     $this->assertInstanceOf(\Generator::class, $this->datasource->getProcess($this->process->getId()));
 }
Beispiel #6
0
 /**
  * @param $id
  * @return mixed
  */
 public function getProfile($id)
 {
     return (new JsonPatch())->compile($this->datasource->getProcess($id));
 }