Example #1
0
 /**
  * Runs the example
  * 
  * @param \PHPSpec\Runner\Reporter $reporter
  */
 public function run(Reporter $reporter)
 {
     try {
         $methodName = $this->_methodName;
         $startTime = microtime(true);
         call_user_func(array($this->_exampleGroup, 'before'));
         call_user_func(array($this->_exampleGroup, $methodName));
         call_user_func(array($this->_exampleGroup, 'after'));
         $endTime = microtime(true);
         $this->_executionTime = $endTime - $startTime;
         if (class_exists('Mockery')) {
             \Mockery::close();
         }
     } catch (Failure $failure) {
         $reporter->addFailure($this, $failure);
         return;
     } catch (Pending $pending) {
         $reporter->addPending($this, $pending);
         return;
     } catch (Error $error) {
         $reporter->addError($this, $error);
         return;
     } catch (\Exception $e) {
         $reporter->addException($this, new Exception($e));
         return;
     }
     $reporter->addPass($this);
 }