Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f9c070802f |
No files matched your search
@@ -46,7 +46,8 @@ final class CoreLibsACLLoginTest extends TestCase
|
|||||||
// database/CoreLibsACLLogin_database_create_data.sql
|
// database/CoreLibsACLLogin_database_create_data.sql
|
||||||
$load_sql_file = __DIR__
|
$load_sql_file = __DIR__
|
||||||
. DIRECTORY_SEPARATOR
|
. DIRECTORY_SEPARATOR
|
||||||
. 'database/CoreLibsACLLogin_database_create_data.sql';
|
. 'database' . DIRECTORY_SEPARATOR
|
||||||
|
. 'CoreLibsACLLogin_database_create_data.sql';
|
||||||
if (!is_file($load_sql_file)) {
|
if (!is_file($load_sql_file)) {
|
||||||
self::markTestIncomplete(
|
self::markTestIncomplete(
|
||||||
'Missing ACL\Login database load SQL file'
|
'Missing ACL\Login database load SQL file'
|
||||||
@@ -63,6 +64,7 @@ final class CoreLibsACLLoginTest extends TestCase
|
|||||||
. "CoreLibsACLLogin_database_prepare.sh "
|
. "CoreLibsACLLogin_database_prepare.sh "
|
||||||
. "$load_sql_file "
|
. "$load_sql_file "
|
||||||
. "$db_user "
|
. "$db_user "
|
||||||
|
. "$db_password "
|
||||||
. "$db_name "
|
. "$db_name "
|
||||||
. "$db_host ";
|
. "$db_host ";
|
||||||
exec($command, $ouput, $result);
|
exec($command, $ouput, $result);
|
||||||
|
|||||||
@@ -22,31 +22,32 @@ if ! command -v dropdb &> /dev/null || ! command -v createdb &> /dev/null || ! c
|
|||||||
fi;
|
fi;
|
||||||
|
|
||||||
db_user="${2}";
|
db_user="${2}";
|
||||||
db_name="${3}";
|
db_password="${3}";
|
||||||
db_host="${4}";
|
db_name="${4}";
|
||||||
|
db_host="${5}";
|
||||||
# empty db name or db user -> exit with 2
|
# empty db name or db user -> exit with 2
|
||||||
if [ -z "${db_user}" ] || [ -z "${db_name}" ] || [ -z "${db_host}" ]; then
|
if [ -z "${db_user}" ] || [ -z "${db_name}" ] || [ -z "${db_password}" ] || [ -z "${db_host}" ]; then
|
||||||
echo 2;
|
echo 2;
|
||||||
exit 2;
|
exit 2;
|
||||||
fi;
|
fi;
|
||||||
# drop database, on error exit with 3
|
# drop database, on error exit with 3
|
||||||
dropdb -U "${db_user}" -h "${db_host}" "${db_name}" 2>&1;
|
PGPASSWORD="${db_password}" dropdb -U "${db_user}" -h "${db_host}" "${db_name}" 2>&1;
|
||||||
if [ ! $? ]; then
|
if [ ! $? ]; then
|
||||||
echo 3;
|
echo 3;
|
||||||
exit 3;
|
exit 3;
|
||||||
fi;
|
fi;
|
||||||
# create database, on error exit with 4
|
# create database, on error exit with 4
|
||||||
createdb -U "${db_user}" -O "${db_user}" -h "${db_host}" -E utf8 "${db_name}" 2>&1;
|
PGPASSWORD="${db_password}" createdb -U "${db_user}" -O "${db_user}" -h "${db_host}" -E utf8 "${db_name}" 2>&1;
|
||||||
if [ ! $? ]; then
|
if [ ! $? ]; then
|
||||||
echo 4;
|
echo 4;
|
||||||
exit 4;
|
exit 4;
|
||||||
fi;
|
fi;
|
||||||
# if error 5 thrown, test with enabled below
|
# if error 5 thrown, test with enabled below
|
||||||
if [ -n "${5}" ]; then
|
if [ -n "${5}" ]; then
|
||||||
psql -U "${db_user}" -h "${db_host}" -f "${load_sql}" "${db_name}";
|
PGPASSWORD="${db_password}" psql -U "${db_user}" -h "${db_host}" -f "${load_sql}" "${db_name}";
|
||||||
else
|
else
|
||||||
# load data (redirect ALL error to null), on error exit with 5
|
# load data (redirect ALL error to null), on error exit with 5
|
||||||
psql -U "${db_user}" -h "${db_host}" -f "${load_sql}" "${db_name}" 2>&1 1>/dev/null 2>/dev/null;
|
PGPASSWORD="${db_password}" psql -U "${db_user}" -h "${db_host}" -f "${load_sql}" "${db_name}" 2>&1 1>/dev/null 2>/dev/null;
|
||||||
fi;
|
fi;
|
||||||
if [ ! $? ]; then
|
if [ ! $? ]; then
|
||||||
echo 5;
|
echo 5;
|
||||||
|
|||||||
Reference in new issue
Block a user