forked from aces/Loris
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
82 lines (66 loc) · 3.31 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
language: php
cache:
directories:
- vendor
php:
- "5.6"
- "7"
sudo: false
addons:
firefox: "44.0"
before_install:
# Start Xvfb in a desktop screen size,
# otherwise some tests will fail because the links
# are hidden when Selenium tries to find them.
- "/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1600x1200x16"
#- "export DISPLAY=:99.0"
#- "sh -e /etc/init.d/xvfb start"
# Ensure node version is up to date
- nvm install node
- mkdir -p project project/libraries
- phpenv config-rm xdebug.ini
install:
# Install composer modules
- composer install
- phpenv rehash
# Install node modules specified in package.json
- npm install
# Download a Selenium Web Driver release
- wget "http://selenium-release.storage.googleapis.com/2.52/selenium-server-standalone-2.52.0.jar"
- php -S localhost:8000 -t htdocs htdocs/router.php 2>1 > /dev/null &
# Extracting firefox and setting PATH variable...
- tar -xjf /tmp/firefox-44.0.tar.bz2 --directory /tmp
- export PATH="/tmp/firefox:$PATH"
- echo "Using firefox version `firefox --version`"
# Start Selenium and redirect Selenium WebDriver
# output to /dev/null so that it doesn't flood the
# screen in the middle of our other tests
- DISPLAY=:99.0 java -jar selenium-server-standalone-2.52.0.jar 2>1 > /dev/null &
before_script:
# Set up the Loris environment
- mkdir -p project smarty/templates_c
- chmod 777 smarty/templates_c
# Set up the MySQL database, install the Schema, create a MySQL user
# for the config file, and reset the Loris user's password for testing
- mysql -e 'CREATE DATABASE LorisTest'
- mysql LorisTest < SQL/0000-00-00-schema.sql
- mysql LorisTest < SQL/0000-00-01-Permission.sql
- mysql LorisTest < SQL/0000-00-02-Menus.sql
- mysql LorisTest < SQL/0000-00-03-ConfigTables.sql
- mysql LorisTest < SQL/0000-00-04-Help.sql
- mysql LorisTest < docs/instruments/radiology_review.sql
- mysql LorisTest -u root -e "GRANT UPDATE,INSERT,SELECT,DELETE,DROP,CREATE TEMPORARY TABLES ON LorisTest.* TO 'SQLTestUser'@'localhost' IDENTIFIED BY 'TestPassword' WITH GRANT OPTION"
- mysql LorisTest -e "UPDATE users SET Password_MD5=CONCAT('aa', MD5('aatestpass')), Pending_approval='N', Password_expiry='2100-01-01' WHERE ID=1"
- cp docs/config/config.xml project/config.xml
- cp docs/config/config.xml test/config.xml
- sed -i -e "s/%HOSTNAME%/127.0.0.1/g" -e "s/%USERNAME%/SQLTestUser/g" -e "s/%PASSWORD%/TestPassword/g" -e "s/%DATABASE%/LorisTest/g" project/config.xml
- sed -i -e "s/%HOSTNAME%/127.0.0.1/g" -e "s/%USERNAME%/SQLTestUser/g" -e "s/%PASSWORD%/TestPassword/g" -e "s/%DATABASE%/LorisTest/g" test/config.xml
- mysql LorisTest -e "UPDATE Config SET Value='$(pwd)/' WHERE ConfigID=(SELECT ID FROM ConfigSettings WHERE Name='base')"
- mysql LorisTest -e "UPDATE Config SET Value='http://localhost:8000' WHERE ConfigID=(SELECT ID FROM ConfigSettings WHERE Name='url')"
#env:
# - "LORIS_DB_CONFIG=test/config.xml"
script:
- npm run lint:php
- npm run lint:javascript
# Run unit tests to make sure functions still do what they should.
- vendor/bin/phpunit --configuration test/phpunit.xml