Exemplo n.º 1
0
 /**
  * Creates a profile point with the specified starting time and memory.
  *
  * This method will only add a point if no other points have been added as the ProfilePointInterface objects created before changing
  * the start point would result in inaccurate measurements.
  *
  * @param   float    $timeStamp    Unix timestamp in microseconds when the profiler should start measuring time.
  * @param   integer  $memoryBytes  Memory amount in bytes when the profiler should start measuring memory.
  *
  * @return  ProfilerInterface  This method is chainable.
  *
  * @since   1.2.0
  * @throws  \RuntimeException
  */
 public function setStart($timeStamp = 0.0, $memoryBytes = 0)
 {
     if (!empty($this->points)) {
         throw new \RuntimeException('The start point cannot be adjusted after points are added to the profiler.');
     }
     $this->startTimeStamp = $timeStamp;
     $this->startMemoryBytes = $memoryBytes;
     $point = new ProfilePoint('start');
     // Store the point.
     $this->points[] = $point;
     // Add it in the lookup table.
     $this->lookup[$point->getName()] = count($this->points) - 1;
     return $this;
 }
 /**
  * Tests the getName method.
  *
  * @return  void
  *
  * @covers  \Joomla\Profiler\ProfilePoint::getName
  * @since   1.0
  */
 public function testGetName()
 {
     $profilePoint = new ProfilePoint('test');
     $this->assertEquals($profilePoint->getName(), 'test');
 }
Exemplo n.º 3
0
 /**
  * @covers  \Joomla\Profiler\ProfilePoint::getName
  */
 public function testThePointNameIsReturned()
 {
     $this->assertEquals($this->instance->getName(), 'test');
 }