Skip to content

Commit 766fc9e

Browse files
authored
Merge pull request #88 from wp-cli/fix-password-variable
2 parents 2faff80 + 17b7fed commit 766fc9e

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

bin/install-package-tests

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,17 @@
22

33
set -ex
44

5+
PASSWORD_STRING=""
6+
if [ -z "DB_PASSWORD" ]; then
7+
PASSWORD_STRING="-p${DB_PASSWORD}"
8+
fi;
9+
510
# Prepare the database for running the tests
611
install_db() {
7-
mysql -e 'CREATE DATABASE IF NOT EXISTS wp_cli_test;' -uroot -p${DB_PASSWORD}
8-
mysql -e 'CREATE USER "wp_cli_test"@"localhost" IDENTIFIED BY "password1"' -uroot -p${DB_PASSWORD}
9-
mysql -e 'GRANT ALL PRIVILEGES ON wp_cli_test.* TO "wp_cli_test"@"localhost"' -uroot -p${DB_PASSWORD}
10-
mysql -e 'GRANT ALL PRIVILEGES ON wp_cli_test_scaffold.* TO "wp_cli_test"@"localhost"' -uroot -p${DB_PASSWORD}
12+
mysql -e 'CREATE DATABASE IF NOT EXISTS wp_cli_test;' -uroot "$PASSWORD_STRING"
13+
mysql -e 'CREATE USER "wp_cli_test"@"localhost" IDENTIFIED BY "password1"' -uroot "$PASSWORD_STRING"
14+
mysql -e 'GRANT ALL PRIVILEGES ON wp_cli_test.* TO "wp_cli_test"@"localhost"' -uroot "$PASSWORD_STRING"
15+
mysql -e 'GRANT ALL PRIVILEGES ON wp_cli_test_scaffold.* TO "wp_cli_test"@"localhost"' -uroot "$PASSWORD_STRING"
1116
}
1217

1318
install_db

0 commit comments

Comments
 (0)