예제 #1
0
 /**
  * Starts the profiling process
  *
  * @param  String $name The optional name of the profile
  *
  * @return Object|\GroundSix\Component\StatsProfiler
  */
 public function start($name = '')
 {
     $profiler = new StatsProfiler($this);
     if ($name !== '') {
         $profiler->setName($name);
     }
     $this->profilers[] =& $profiler;
     return $profiler;
 }
예제 #2
0
 public function testDestructor()
 {
     $profiler_1 = new StatsProfiler();
     $profiler_1->setLogger($this->logger);
     $profiler_2 = $profiler_1->start();
     $profiler_1->__destruct();
     $this->assertNotNull($profiler_2->fetch()->getEndTime());
     $this->assertContains($profiler_2->fetch()->toJson(), $this->logger->debugData);
 }