Skip to content

Commit

Permalink
Add support for running complete test suite on Travis CI
Browse files Browse the repository at this point in the history
Fixes #16126: Setup integration testing on Travis CI
  • Loading branch information
rombert committed Jul 12, 2013
1 parent 5945c9c commit 2b97666
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .travis.yml
@@ -0,0 +1,12 @@
language: php

php:
- 5.4

before_script: ./scripts/travis_before_script.sh

env:
- DB=mysql
- DB=pgsql

script: phpunit --bootstrap ./tests/bootstrap.php ./tests/AllTests.php
28 changes: 28 additions & 0 deletions scripts/travis_before_script.sh
@@ -0,0 +1,28 @@
#!/bin/sh

# create database
if [ $DB = 'mysql' ]; then
mysql -e 'create database bugtracker;'
DB_USER='root'
elif [ $DB = 'pgsql' ]; then
psql -c 'CREATE DATABASE bugtracker;' -U postgres
psql -c "ALTER USER postgres SET bytea_output = 'escape';" -U postgres
DB_USER='postgres'
fi

# start embedded server
php -S localhost:8000 &
sleep 5

# trigger installation
curl --data "install=2&hostname=localhost&db_username=${DB_USER}&db_type=${DB}&db_password=&database_name=bugtracker&admin_username=${DB_USER}&admin_password=" http://localhost:8000/admin/install.php

# create the first project
if [ $DB = 'mysql' ]; then
mysql -e "INSERT INTO mantis_project_table(name, inherit_global) VALUES('First project', 1)" bugtracker
elif [ $DB = 'pgsql' ]; then
psql -c "INSERT INTO mantis_project_table(name, inherit_global, description) VALUES('First project', 1, '')" -d bugtracker -U postgres
fi

# enable SOAP tests
echo "<?php \$GLOBALS['MANTIS_TESTSUITE_SOAP_ENABLED'] = true; \$GLOBALS['MANTIS_TESTSUITE_SOAP_HOST'] = 'http://localhost:8000/api/soap/mantisconnect.php?wsdl';?>" > ./tests/bootstrap.php

0 comments on commit 2b97666

Please sign in to comment.