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); }
public function runGroup($name) { /** @var CollectorInterface $collector */ foreach ($this->collectors[$name] as $collector) { try { $collector->resolve(); if ($collector instanceof Request) { $data = $collector->getData(); $this->datasource->saveSummary($this->context->getProcess(), ['id' => $this->context->getProcess()->getId(), 'method' => $data['method'], 'uri' => $data['uri'], 'time' => time()]); } elseif ($collector instanceof ResponseCollector) { $this->datasource->saveSummary($this->context->getProcess(), ['status' => $collector->getStatusCode()]); } $collector->persist(); } catch (\Exception $e) { if (!$this->logger === null) { $this->emergency($e->getMessage(), ['collector', get_class($collector)]); } } } }
public function testSaveSummary() { $process = Process::build(); $this->datasource->saveSummary($process, ['foo' => 'bar']); $this->assertEquals(0, $this->datasource->count()); }