示例#1
0
 public function testData()
 {
     $profiler = ProfilerFactory::build([ProfilerFactory::OPTION_ENABLE => true, ProfilerFactory::OPTION_DATASOURCE_CLASS => File::class, ProfilerFactory::OPTION_DATASOURCE_PROFILES_FOLDER => '/tmp', ProfilerFactory::OPTION_COLLECTORS => [PhpVersion::class]]);
     $profiler->initiate();
     $profiler->terminate();
     $renderer = new Process($this->objectToArray($profiler->getProfile($profiler->getContext()->getProcess()->getId())), $profiler);
     $this->assertInternalType('array', $renderer->getData());
     $this->assertNotEmpty($renderer->getData());
     $this->assertArrayHasKey('collectors', $renderer->getData());
     $this->assertArrayHasKey('bar', $renderer->getData());
     $this->assertNotEmpty($renderer->getTitle());
     $this->assertNotEmpty($renderer->getIcon());
     $this->assertNotEmpty($renderer->content());
 }
示例#2
0
文件: Web.php 项目: ndrx-io/profiler
 /**
  * @param $id
  * @return string
  */
 public function show($id)
 {
     $profile = $this->objectToArray($this->profiler->getProfile($id));
     $renderer = new Process($profile, $this->profiler);
     return $renderer->content();
 }