|
| 1 | +<?php |
| 2 | +/** |
| 3 | + * Loads configuration parameters. |
| 4 | + * |
| 5 | + * Don't modify this file directly. |
| 6 | + * Create and use 'params.local.php' instead. |
| 7 | + * |
| 8 | + * @since {VERSION} |
| 9 | + * @link {URL} |
| 10 | + * @license GPLv2 or later |
| 11 | + * @package PluginName |
| 12 | + * @author {AUTHOR} |
| 13 | + */ |
| 14 | + |
| 15 | +use Codeception\Exception\ConfigurationException; |
| 16 | +use Codeception\Lib\ParamsLoader; |
| 17 | + |
| 18 | +global $argv; |
| 19 | + |
| 20 | +if ( ! in_array( 'acceptance', $argv, true ) ) { |
| 21 | + return []; |
| 22 | +} |
| 23 | + |
| 24 | +if ( ! in_array( 'github-actions', $argv, true ) ) { |
| 25 | + try { |
| 26 | + ( new ParamsLoader() )->load( '.env.development' ); |
| 27 | + } catch ( ConfigurationException $e ) { |
| 28 | + throw new Exception( 'If you wan\'t to run your tests locally, then create the `.env.development` configuration file.' ); |
| 29 | + } |
| 30 | +} |
| 31 | + |
| 32 | +return [ |
| 33 | + 'WP_URL' => getenv( 'WP_URL' ), |
| 34 | + 'WP_ADMIN_USERNAME' => getenv( 'WP_ADMIN_USERNAME' ), |
| 35 | + 'WP_ADMIN_PASSWORD' => getenv( 'WP_ADMIN_PASSWORD' ), |
| 36 | + 'WP_ADMIN_PATH' => getenv( 'WP_ADMIN_PATH' ), |
| 37 | + 'DB_HOST' => getenv( 'DB_HOST' ), |
| 38 | + 'DB_NAME' => getenv( 'DB_NAME' ), |
| 39 | + 'DB_USER' => getenv( 'DB_USER' ), |
| 40 | + 'DB_PASSWORD' => getenv( 'DB_PASSWORD' ), |
| 41 | + 'DB_TABLE_PREFIX' => getenv( 'DB_TABLE_PREFIX' ), |
| 42 | +]; |
| 43 | + |
0 commit comments