Ejemplo n.º 1
0
 /**
  * Run test
  *
  * @param string  $name
  * @param Closure $callback
  *
  * @return Apishka_Tester_Result
  */
 protected function runTest($name, $callback)
 {
     try {
         call_user_func($callback);
     } catch (Throwable $e) {
         return Apishka_Tester_Result::apishka($name, false)->setException($e);
     }
     return Apishka_Tester_Result::apishka($name);
 }
Ejemplo n.º 2
0
 /**
  * Execute
  *
  * @return mixed
  */
 public function execute($debug_callback = null)
 {
     $router = Apishka_Tester_Router::apishka();
     $result = array();
     foreach ($this->getTestsConfig() as $package => $config) {
         $subresult = array();
         $tests = $config['tests'];
         foreach ($tests as $test) {
             if ($debug_callback !== null) {
                 $debug_callback('Running test ' . var_export($test[0], true));
             }
             $subresult[] = $router->getItem($test[0])->runExecute($test, $debug_callback);
         }
         $result[] = Apishka_Tester_Result::apishka('Package ' . $package, $subresult);
     }
     return Apishka_Tester_Result::apishka('Environment', $result);
 }