Use local configuration in tests
This way the tests should really run out of the box with what is described in TESTING.md.
This commit is contained in:
parent
625f92fe44
commit
1ca47d67d5
6 changed files with 41 additions and 10 deletions
|
@ -8,7 +8,6 @@ services:
|
|||
env:
|
||||
global:
|
||||
- ENVIRONMENT=testing
|
||||
- LIBRETIME_CONF_DIR=/tmp/libretime
|
||||
- LIBRETIME_LOG_DIR=/tmp/log/libretime
|
||||
install:
|
||||
- composer install
|
||||
|
@ -17,7 +16,6 @@ before_script:
|
|||
- psql -c "CREATE USER libretime WITH PASSWORD 'libretime';" -U postgres
|
||||
- psql -c 'GRANT CONNECT ON DATABASE libretime TO libretime;' -U postgres
|
||||
- psql -c 'ALTER USER libretime CREATEDB;' -U postgres
|
||||
- mkdir -p /tmp/libretime/testing/ /tmp/log/libretime
|
||||
- cp airtime_mvc/tests/airtime.conf airtime_mvc/tests/cloud_storage.conf /tmp/libretime/testing/
|
||||
- mkdir -p /tmp/log/libretime
|
||||
script:
|
||||
- cd airtime_mvc/tests && ../../vendor/bin/phpunit
|
||||
|
|
|
@ -17,12 +17,8 @@ class Config {
|
|||
"rootDir" => self::$rootDir
|
||||
);
|
||||
|
||||
//In the unit testing environment, we always want to use our local airtime.conf in airtime_mvc/application/test:
|
||||
if (getenv('AIRTIME_UNIT_TEST') == '1') {
|
||||
$filename = "airtime.conf";
|
||||
} else {
|
||||
//In the unit testing environment, LIBRETIME_CONF_DIR will our local airtime.conf in airtime_mvc/application/test/conf:
|
||||
$filename = isset($_SERVER['AIRTIME_CONF']) ? $_SERVER['AIRTIME_CONF'] : LIBRETIME_CONF_DIR . "/airtime.conf";
|
||||
}
|
||||
|
||||
$values = parse_ini_file($filename, true);
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
[database]
|
||||
host = localhost
|
||||
|
||||
host = postgresql
|
||||
dbname = libretime_test
|
||||
dbuser = libretime
|
||||
dbpass = libretime
|
35
airtime_mvc/tests/conf/testing/airtime.conf
Normal file
35
airtime_mvc/tests/conf/testing/airtime.conf
Normal file
|
@ -0,0 +1,35 @@
|
|||
[database]
|
||||
|
||||
host = postgresql
|
||||
dbname = libretime_test
|
||||
dbuser = libretime
|
||||
dbpass = libretime
|
||||
|
||||
[rabbitmq]
|
||||
host = 127.0.0.1
|
||||
port = 5672
|
||||
user = airtime_tests
|
||||
password = airtime_tests
|
||||
vhost = /airtime_tests
|
||||
|
||||
[general]
|
||||
dev_env = testing
|
||||
api_key = H2NRICX6CM8F50CU123C
|
||||
web_server_user = www-data
|
||||
airtime_dir = /usr/share/airtime
|
||||
base_url = localhost
|
||||
base_port = 80
|
||||
base_dir = /
|
||||
cache_ahead_hours = 1
|
||||
station_id = teststation
|
||||
|
||||
[monit]
|
||||
monit_user = guest
|
||||
monit_password = airtime
|
||||
|
||||
[soundcloud]
|
||||
connection_retries = 3
|
||||
time_between_retries = 60
|
||||
soundcloud_client_id = 0
|
||||
soundcloud_client_secret = 0
|
||||
soundcloud_redirect_uri = http://soundcloud.example.org/redirect
|
|
@ -17,6 +17,7 @@
|
|||
<php>
|
||||
<env name="ENVIRONMENT" value="testing"/>
|
||||
<env name="AIRTIME_UNIT_TEST" value="1"/>
|
||||
<env name="LIBRETIME_CONF_DIR" value="./conf"/>
|
||||
</php>
|
||||
|
||||
<!-- Disabling broken code coverage report. It's not using our autoloader for some reason...
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue