App\Lib\Codeception::getRunResponse PHP Method

getRunResponse() public method

Given a test type & hash, handle the test run response for the AJAX call.
public getRunResponse ( string $type, string $hash ) : array
$type string Test type (Unit, Acceptance, Functional)
$hash string Hash of the test.
return array Array of flags used in the JSON respone.
    public function getRunResponse($type, $hash)
    {
        $response = array('message' => NULL, 'run' => FALSE, 'passed' => FALSE, 'state' => 'error', 'log' => NULL);
        // If Codeceptions not properly configured, the test won't be found
        // and it won't be run.
        if (!$this->ready()) {
            $response['message'] = 'The Codeception configuration could not be loaded.';
        }
        // If the test can't be found, we can't run the test.
        if (!($test = $this->getTest($type, $hash))) {
            $response['message'] = 'The test could not be found.';
        }
        // If there's no error message set yet, it means we're good to go!
        if (is_null($response['message'])) {
            // Run the test!
            $test = $this->run($test);
            $response['run'] = $test->ran();
            $response['log'] = $test->getLog();
            $response['passed'] = $test->passed();
            $response['state'] = $test->getState();
            $response['title'] = $test->getTitle();
        }
        return $response;
    }