You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Prepare the database for running the tests with a MySQL version 8.0 or higher.
45
51
install_mysql_db_8_0_plus() {
46
52
set -ex
47
-
mysql -e "CREATE DATABASE IF NOT EXISTS \`wp_cli_test\`;"$HOST_STRING -u"$USER""$PASSWORD_STRING"
48
-
mysql -e "CREATE USER IF NOT EXISTS \`wp_cli_test\`@'%' IDENTIFIED WITH mysql_native_password BY '$TEST_PASSWORD'"$HOST_STRING -u"$USER""$PASSWORD_STRING"
49
-
mysql -e "GRANT ALL PRIVILEGES ON \`wp_cli_test\`.* TO '$TEST_USER'@'%'"$HOST_STRING -u"$USER""$PASSWORD_STRING"
50
-
mysql -e "GRANT ALL PRIVILEGES ON \`wp_cli_test_scaffold\`.* TO '$TEST_USER'@'%'"$HOST_STRING -u"$USER""$PASSWORD_STRING"
53
+
mysql -e "CREATE DATABASE IF NOT EXISTS \`${TEST_DB}\`;"${HOST_STRING} -u"${USER}""${PASSWORD_STRING}"
54
+
mysql -e "CREATE USER IF NOT EXISTS \`${TEST_DB}\`@'%' IDENTIFIED WITH mysql_native_password BY '${TEST_PASSWORD}'"${HOST_STRING} -u"${USER}""${PASSWORD_STRING}"
55
+
mysql -e "GRANT ALL PRIVILEGES ON \`${TEST_DB}\`.* TO '${TEST_USER}'@'%'"${HOST_STRING} -u"${USER}""${PASSWORD_STRING}"
56
+
mysql -e "GRANT ALL PRIVILEGES ON \`${TEST_DB}_scaffold\`.* TO '${TEST_USER}'@'%'"${HOST_STRING} -u"${USER}""${PASSWORD_STRING}"
51
57
}
52
58
53
59
# Prepare the database for running the tests with a MySQL version lower than 8.0.
54
60
install_mysql_db_lower_than_8_0() {
55
61
set -ex
56
-
mysql -e "CREATE DATABASE IF NOT EXISTS \`wp_cli_test\`;"$HOST_STRING -u"$USER""$PASSWORD_STRING"
57
-
mysql -e "GRANT ALL ON \`wp_cli_test\`.* TO '$TEST_USER'@'%' IDENTIFIED BY '$TEST_PASSWORD'"$HOST_STRING -u"$USER""$PASSWORD_STRING"
58
-
mysql -e "GRANT ALL ON \`wp_cli_test_scaffold\`.* TO '$TEST_USER'@'%' IDENTIFIED BY '$TEST_PASSWORD'"$HOST_STRING -u"$USER""$PASSWORD_STRING"
62
+
mysql -e "CREATE DATABASE IF NOT EXISTS \`${TEST_DB}\`;"${HOST_STRING} -u"${USER}""${PASSWORD_STRING}"
63
+
mysql -e "GRANT ALL ON \`${TEST_DB}\`.* TO '${TEST_USER}'@'%' IDENTIFIED BY '${TEST_PASSWORD}'"${HOST_STRING} -u"${USER}""${PASSWORD_STRING}"
64
+
mysql -e "GRANT ALL ON \`${TEST_DB}_scaffold\`.* TO '${TEST_USER}'@'%' IDENTIFIED BY '${TEST_PASSWORD}'"${HOST_STRING} -u"${USER}""${PASSWORD_STRING}"
Copy file name to clipboardExpand all lines: src/Context/FeatureContext.php
+47-42Lines changed: 47 additions & 42 deletions
Original file line number
Diff line number
Diff line change
@@ -51,24 +51,24 @@ class FeatureContext implements SnippetAcceptingContext {
51
51
/**
52
52
* The test database settings. All but `dbname` can be set via environment variables. The database is dropped at the start of each scenario and created on a "Given a WP installation" step.
53
53
*/
54
-
privatestatic$db_settings = array(
54
+
privatestatic$db_settings = [
55
55
'dbname' => 'wp_cli_test',
56
56
'dbuser' => 'wp_cli_test',
57
57
'dbpass' => 'password1',
58
58
'dbhost' => '127.0.0.1',
59
-
);
59
+
];
60
60
61
61
/**
62
62
* Array of background process ids started by the current scenario. Used to terminate them at the end of the scenario.
63
63
*/
64
-
private$running_procs = array();
64
+
private$running_procs = [];
65
65
66
66
/**
67
67
* Array of variables available as {VARIABLE_NAME}. Some are always set: CORE_CONFIG_SETTINGS, DB_USER, DB_PASSWORD, DB_HOST, SRC_DIR, CACHE_DIR, WP_VERSION-version-latest.
68
68
* Some are step-dependent: RUN_DIR, SUITE_CACHE_DIR, COMPOSER_LOCAL_REPOSITORY, PHAR_PATH. One is set on use: INVOKE_WP_CLI_WITH_PHP_ARGS-args.
69
69
* Scenarios can define their own variables using "Given save" steps. Variables are reset for each scenario.
70
70
*/
71
-
public$variables = array();
71
+
public$variables = [];
72
72
73
73
/**
74
74
* The current feature file and scenario line number as '<file>.<line>'. Used in RUN_DIR and SUITE_CACHE_DIR directory names. Set at the start of each scenario.
@@ -84,9 +84,9 @@ class FeatureContext implements SnippetAcceptingContext {
84
84
privatestatic$num_top_processes; // Number of processes/methods to output by longest run times. Set on `@BeforeSuite`.
85
85
privatestatic$num_top_scenarios; // Number of scenarios to output by longest run times. Set on `@BeforeSuite`.
86
86
87
-
privatestatic$scenario_run_times = array(); // Scenario run times (top `self::$num_top_scenarios` only).
87
+
privatestatic$scenario_run_times = []; // Scenario run times (top `self::$num_top_scenarios` only).
88
88
privatestatic$scenario_count = 0; // Scenario count, incremented on `@AfterScenario`.
89
-
privatestatic$proc_method_run_times = array(); // Array of run time info for proc methods, keyed by method name and arg, each a 2-element array containing run time and run count.
89
+
privatestatic$proc_method_run_times = []; // Array of run time info for proc methods, keyed by method name and arg, each a 2-element array containing run time and run count.
90
90
91
91
/**
92
92
* Get the path to the Composer vendor folder.
@@ -211,11 +211,11 @@ private static function get_process_env_variables() {
0 commit comments