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())); }
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); }
/** * 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 = []; }
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())); }
public function testPersist() { $this->collector->resolve(); $this->collector->persist(); $this->assertInstanceOf(\Generator::class, $this->datasource->getProcess($this->process->getId())); }
/** * @param $id * @return mixed */ public function getProfile($id) { return (new JsonPatch())->compile($this->datasource->getProcess($id)); }
public function testSaveSummary() { $process = Process::build(); $this->datasource->saveSummary($process, ['foo' => 'bar']); $this->assertEquals(0, $this->datasource->count()); }