示例#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();
     $profiles = $profiler->getDatasource()->all(0, 10);
     $renderer = new ProcessList($profiles);
     $this->assertInternalType('array', $renderer->getData());
     $this->assertNotEmpty($renderer->getData());
     $this->assertArrayHasKey('profiles', $renderer->getData());
     $this->assertNotEmpty($renderer->getTitle());
     $this->assertNotEmpty($renderer->getIcon());
     $this->assertNotEmpty($renderer->content());
 }
示例#2
0
文件: Web.php 项目: ndrx-io/profiler
 /**
  * @param int $offset
  * @param int $limit
  * @return string
  */
 public function index($offset = 0, $limit = 20)
 {
     $profiles = $this->profiler->getDatasource()->all($offset, $limit);
     $renderer = new ProcessList($profiles);
     return $renderer->content();
 }