Пример #1
0
 public function actionRunTest($hash)
 {
     Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
     $site = null;
     $test = null;
     $sites = SiteController::getAvailableSites();
     foreach ($sites as $s) {
         foreach ($s->tests as $t) {
             if ($t->hash === $hash) {
                 $site = $s;
                 $test = $t;
             }
         }
     }
     $response = ['message' => null, 'run' => false, 'passed' => false, 'state' => 'error', 'log' => null];
     if (is_null($response['message'])) {
         $this->run($site, $test);
         $response['run'] = $test->ran();
         $response['log'] = $test->getLog();
         $response['passed'] = $test->passed();
         $response['state'] = $test->state;
         $response['title'] = $test->title;
     }
     return $response;
 }
 /**
  * Routed Actions - Views Rendering
  */
 public function actionIndex()
 {
     $sites = SiteController::getAvailableSites();
     // Checking the configuration
     $logging_passed = true;
     foreach ($sites as $site) {
         if (!$site->logging['passed']) {
             $logging_passed = false;
         }
     }
     $checks = ['configuration' => CodeceptionController::checkConfiguration(), 'executable' => CodeceptionController::checkExecutable(), 'logging' => $logging_passed];
     return $this->render('index', ['sites' => $sites, 'checks' => $checks]);
 }