App\Lib\Codeception::loadConfig PHP Method

loadConfig() public method

Load the Codeception YAML configuration.
public loadConfig ( string $path, string $file ) : array
$path string
$file string
return array $config
    public function loadConfig($path, $file)
    {
        $full_path = $path . $file;
        // If the Codeception YAML can't be found, the application can't go any further.
        if (!file_exists($full_path)) {
            return false;
        }
        // Using Symfony's Yaml parser, the file gets turned into an array.
        $config = \Symfony\Component\Yaml\Yaml::parse(file_get_contents($full_path));
        if (!isset($config['paths']) || !is_array($config['paths'])) {
            throw new \Exception("The config does not appear to contain any paths: " . $path . $file);
        }
        // Update the config to include the full path.
        foreach ($config['paths'] as $key => &$test_path) {
            $test_path = file_exists($path . $test_path) ? realpath($path . $test_path) : $path . $test_path;
        }
        $config['env'] = array();
        if (isset($this->config['tests'])) {
            foreach ($this->config['tests'] as $type => $active) {
                if (!$active) {
                    break;
                }
                if ($suite = \Symfony\Component\Yaml\Yaml::parse($config['paths']['tests'] . "/{$type}.suite.yml")) {
                    if (isset($suite['env'])) {
                        $config['env'][$type] = array_keys($suite['env']);
                    }
                }
            }
        }
        return $config;
    }