Skip to content
Browse files

Add support for running complete test suite on Travis CI

Fixes #16126: Setup integration testing on Travis CI
  • Loading branch information...
1 parent 5945c9c commit 2b9766609320731f45ab46d282a8aa1af0198728 @rombert rombert committed
Showing with 40 additions and 0 deletions.
  1. +12 −0 .travis.yml
  2. +28 −0 scripts/travis_before_script.sh
View
12 .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
View
28 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.
Something went wrong with that request. Please try again.