aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/phpunit-pgsql.xml9
-rw-r--r--tests/phpunit.xml.dist9
-rwxr-xr-xtests/travis/prepare_mysql.sh12
-rwxr-xr-xtests/travis/prepare_pgsql.sh14
4 files changed, 23 insertions, 21 deletions
diff --git a/tests/phpunit-pgsql.xml b/tests/phpunit-pgsql.xml
index d95c4897b..078056d56 100644
--- a/tests/phpunit-pgsql.xml
+++ b/tests/phpunit-pgsql.xml
@@ -33,13 +33,14 @@
<log type="testdox-text" target="./results/testdox.txt"/>
</logging>
<php>
- <!-- default test database config, only used if no environment variables
- with same name set -->
+ <!-- Default test database config, only used if no environment variables
+ with same names are set.
+ !!! Never run against a real database, it will truncate all tables -->
<env name="hz_db_server" value="127.0.0.1"/>
<env name="hz_db_scheme" value="pgsql"/>
<env name="hz_db_port" value="5432"/>
- <env name="hz_db_user" value="hubzilla"/>
+ <env name="hz_db_user" value="travis_hz"/>
<env name="hz_db_pass" value="hubzilla"/>
- <env name="hz_db_database" value="hubzilla"/>
+ <env name="hz_db_database" value="travis_hubzilla"/>
</php>
</phpunit>
diff --git a/tests/phpunit.xml.dist b/tests/phpunit.xml.dist
index 7b9c1d563..97c84fb81 100644
--- a/tests/phpunit.xml.dist
+++ b/tests/phpunit.xml.dist
@@ -36,13 +36,14 @@
<log type="testdox-text" target="./results/testdox.txt"/>
</logging>
<php>
- <!-- default test database config, only used if no environment variables
- with same name set -->
+ <!-- Default test database config, only used if no environment variables
+ with same names are set.
+ !!! Never run against a real database, it will truncate all tables -->
<env name="hz_db_server" value="127.0.0.1"/>
<env name="hz_db_scheme" value="mysql"/>
<env name="hz_db_port" value="3306"/>
- <env name="hz_db_user" value="hubzilla"/>
+ <env name="hz_db_user" value="travis_hz"/>
<env name="hz_db_pass" value="hubzilla"/>
- <env name="hz_db_database" value="hubzilla"/>
+ <env name="hz_db_database" value="travis_hubzilla"/>
</php>
</phpunit>
diff --git a/tests/travis/prepare_mysql.sh b/tests/travis/prepare_mysql.sh
index 9fd79c1ab..5b1c96d78 100755
--- a/tests/travis/prepare_mysql.sh
+++ b/tests/travis/prepare_mysql.sh
@@ -25,7 +25,7 @@
# Exit if anything fails
set -e
-echo "Preparing for MySQL ..."
+echo "Preparing for MySQL/MariaDB ..."
if [[ "$MYSQL_VERSION" == "5.7" ]]; then
echo "Using MySQL 5.7 in Docker container, need to use TCP"
@@ -41,13 +41,13 @@ mysql $PROTO -e "SHOW VARIABLES LIKE 'character_set%';"
mysql $PROTO -e "SELECT @@sql_mode;"
# Create Hubzilla database
-mysql $PROTO -u root -e "CREATE DATABASE IF NOT EXISTS hubzilla;";
-mysql $PROTO -u root -e "CREATE USER 'hubzilla'@'%' IDENTIFIED BY 'hubzilla';"
-mysql $PROTO -u root -e "GRANT ALL ON hubzilla.* TO 'hubzilla'@'%';"
+mysql $PROTO -u root -e "CREATE DATABASE IF NOT EXISTS travis_hubzilla;";
+mysql $PROTO -u root -e "CREATE USER 'travis_hz'@'%' IDENTIFIED BY 'hubzilla';"
+mysql $PROTO -u root -e "GRANT ALL ON travis_hubzilla.* TO 'travis_hz'@'%';"
# Import table structure
-mysql $PROTO -u root hubzilla < ./install/schema_mysql.sql
+mysql $PROTO -u root travis_hubzilla < ./install/schema_mysql.sql
# Show databases and tables
mysql $PROTO -u root -e "SHOW DATABASES;"
-mysql $PROTO -u root -e "USE hubzilla; SHOW TABLES;"
+mysql $PROTO -u root -e "USE travis_hubzilla; SHOW TABLES;"
diff --git a/tests/travis/prepare_pgsql.sh b/tests/travis/prepare_pgsql.sh
index 3c38ef60c..0175b9858 100755
--- a/tests/travis/prepare_pgsql.sh
+++ b/tests/travis/prepare_pgsql.sh
@@ -33,17 +33,17 @@ psql --version
psql -U postgres -c "SELECT VERSION();"
# Create Hubzilla database
-psql -U postgres -c "DROP DATABASE IF EXISTS hubzilla;"
+psql -U postgres -c "DROP DATABASE IF EXISTS travis_hubzilla;"
psql -U postgres -v ON_ERROR_STOP=1 <<-EOSQL
- CREATE USER hubzilla WITH PASSWORD 'hubzilla';
- CREATE DATABASE hubzilla;
- ALTER DATABASE hubzilla OWNER TO hubzilla;
- GRANT ALL PRIVILEGES ON DATABASE hubzilla TO hubzilla;
+ CREATE USER travis_hz WITH PASSWORD 'hubzilla';
+ CREATE DATABASE travis_hubzilla;
+ ALTER DATABASE travis_hubzilla OWNER TO travis_hz;
+ GRANT ALL PRIVILEGES ON DATABASE travis_hubzilla TO travis_hz;
EOSQL
# Import table structure
-psql -U hubzilla -v ON_ERROR_STOP=1 hubzilla < ./install/schema_postgres.sql
+psql -U travis_hz -v ON_ERROR_STOP=1 travis_hubzilla < ./install/schema_postgres.sql
# Show databases and tables
psql -U postgres -l
-psql -U postgres -d hubzilla -c "\dt;"
+psql -U postgres -d travis_hubzilla -c "\dt;"