-
Notifications
You must be signed in to change notification settings - Fork 163
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1042 from jonocodes/test-env-vars
Automate running local tests
- Loading branch information
Showing
4 changed files
with
54 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
CREATE TABLE IF NOT EXISTS hm_user (username varchar(255), hash varchar(255), primary key (username)); | ||
|
||
CREATE TABLE IF NOT EXISTS hm_user_session (hm_id varchar(255), data longblob, date timestamp, primary key (hm_id)); | ||
|
||
CREATE TABLE IF NOT EXISTS hm_user_settings(username varchar(255), settings longblob, primary key (username)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
INSERT OR REPLACE INTO hm_user values('unittestuser', 'sha512:86000:xfEgf7NIUQ2XkeU5tnIcA+HsN8pUllMVdzpJxCSwmbsZAE8Hze3Zs+MeIqepwocYteJ92vhq7pjOfrVThg/p1voELkDdPenU8i2PgG9UTI0IJTGhMN7rsUILgT6XlMAKLp/u2OD13sukUFcQNTdZNFqMsuTVTYw/Me2tAnFwgO4=:rfyUhYsWBCknx6EmbeswN0fy0hAC0N3puXzwWyDRquA='); | ||
|
||
INSERT OR REPLACE INTO hm_user values('testuser', '\$argon2id\$v=19\$m=65536,t=2,p=1\$dw4pTU24zRKHCEkLcloU/A\$9NJm6ALQhVpB2HTHmVHjOai912VhURUDAPsut5lrEa0'); | ||
|
||
INSERT OR REPLACE INTO hm_user_settings values('testuser', 'sFpVPU/hPvmfeiEKUBs4w1EizmbW/Ze2BALZf6kdJrIU3KVZrsqIhKaWTNNFRm3p51ssRAH2mpbxBMhsdpOAqIZMXFHjLttRu9t5WZWOkN7qwEh2LRq6imbkMkfqXg//K294QDLyWjE0Lsc/HSGqnguBF0YUVLVmWmdeqq7/OrXUo4HNbU88i4s2gkukKobJA2hjcOEq/rLOXr3t4LnLlcISnUbt4ptalSbeRrOnx4ehZV8hweQf1E+ID7s/a+8HHx1Qo713JDzReoLEKUsxRQ=='); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/usr/bin/env bash | ||
|
||
# example run: ./run.sh --filter=Hm_Test_Core_Message_Functions | ||
|
||
set -e | ||
|
||
SCRIPT_DIR=$(dirname $(realpath "$0")) | ||
|
||
DB="${DB:-sqlite}" | ||
|
||
echo "SETTING UP DB $DB" | ||
|
||
export DB_DRIVER=$DB | ||
export DB_NAME=cypht_test | ||
|
||
if [ "$DB" = "sqlite" ]; then | ||
|
||
FILE=/tmp/test.db | ||
|
||
export DB_CONNECTION_TYPE=socket | ||
export DB_SOCKET=${FILE} | ||
|
||
cat ${SCRIPT_DIR}/data/schema.sql | sqlite3 ${FILE} | ||
cat ${SCRIPT_DIR}/data/seed.sql | sqlite3 ${FILE} | ||
|
||
# elif [ "$DB" = "mysql" ]; then # TODO | ||
|
||
# elif [ "$DB" = "pgsql" ]; then # TODO | ||
|
||
else | ||
echo "Database not supported in test: ${DB}" | ||
exit 1 | ||
fi | ||
|
||
phpunit --configuration ${SCRIPT_DIR}/phpunit.xml $@ |