コード例 #1
0
 public function __call($key_, $args_)
 {
     if (null === ($method = $this->getMethod($key_))) {
         return null;
     }
     // FIXME Re-integrate profiling.
     $profileMethod = 'profileCall';
     if (Test_Profiler::isForkedProfilingSupported() && array_key_exists($method->name, $this->m_profileMethodsForked)) {
         $profileMethod = 'profileCallForked';
     }
     ob_start();
     $returnValue = null;
     if (true === array_key_exists($method->name, $this->m_profileMethods)) {
         $this->m_profileMethods[$method->name] = Test_Profiler::$profileMethod([$this->m_instance, $this->m_methods[$method->name]->name]);
         $this->m_exceptions[$method->name] = $this->m_profileMethods[$method->name]->exception();
         $returnValue = $this->m_profileMethods[$method->name]->returnValue();
     } else {
         try {
             if ($this->m_methods[$method->name]->isStatic()) {
                 $returnValue = $this->m_methods[$method->name]->invoke($this->m_class);
             } else {
                 $returnValue = $this->m_instance->{$this->m_methods[$method->name]->name}();
             }
         } catch (\Exception $e) {
             $this->m_exceptions[$method->name] = Exception_Flat::create($e);
         }
     }
     $this->m_failed[$method->name] = true;
     if (false === isset($this->m_exceptionsExpected[$method->name]) && false === isset($this->m_exceptions[$method->name])) {
         $this->m_failed[$method->name] = false;
     } else {
         if (isset($this->m_exceptionsExpected[$method->name]) && isset($this->m_exceptions[$method->name])) {
             if ($this->m_exceptionsExpected[$method->name] == $this->m_exceptions[$method->name]->type) {
                 $this->m_failed[$method->name] = false;
             } else {
                 $exceptionReflection = new \ReflectionClass($this->m_exceptions[$method->name]);
                 if ($exceptionReflection->isSubclassOf($this->m_exceptionsExpected[$method->name])) {
                     $this->m_failed[$method->name] = false;
                 }
             }
         }
     }
     if (trim($output = ob_get_clean())) {
         $this->m_output[$method->name] = $output;
     }
     return $returnValue;
 }
コード例 #2
0
function split_time($description_)
{
    Test_Profiler::split($description_);
}