protected function setUp() { parent::setUp(); $this->datasource = new Memory(); $this->profiler = new Profiler(); $this->profiler->setDataSource($this->datasource); $this->process = $this->profiler->getContext()->getProcess(); $this->collector = new Log($this->process, $this->profiler->getDatasource()); $this->profiler->registerCollector($this->collector); }
protected function setUp() { parent::setUp(); $this->datasource = new Memory(); $this->profiler = new Profiler(); $dispatcher = $this->profiler->getContext()->getProcess()->getDispatcher(); $this->profiler->setTimeline(new TimelineComponent($dispatcher)); $this->profiler->setDataSource($this->datasource); $this->process = $this->profiler->getContext()->getProcess(); $this->collector = new Timeline($this->process, $this->profiler->getDatasource()); $this->profiler->registerCollector($this->collector); }
public function testTerminateFileDatasource() { $folder = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR; $this->profiler->setDataSource(new File($folder)); $this->profiler->registerCollectorClasses([Duration::class, Request::class, Http::class]); $this->profiler->initiate(); $this->profiler->terminate(); $process = $this->profiler->getContext()->getProcess(); $this->assertInstanceOf(\Generator::class, $this->profiler->getDatasource()->getProcess($process->getId())); $profile = $this->profiler->getProfile($process->getId()); $this->assertObjectHasAttribute('duration', $profile); }