diff --git a/.travis.yml b/.travis.yml index d30eeff5..9a4e579c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,13 +12,9 @@ env: - DB=mysql - DB=pgsql -before_install: - - sudo apt-get update > /dev/null - - sudo chmod u+x tests/setup_test_env.sh - install: - # Install nginx, php5-fpm and configure them - - sudo ./tests/setup_test_env.sh $TRAVIS_BUILD_DIR + - mkdir -p data + - php -S 127.0.0.1:8080 tests/router.php >>data/php.log 2>>data/php.log & sleep 3 # Enable logging of all queries (for debugging) and create the database schema for shimmie. - if [[ "$DB" == "pgsql" ]]; then psql -c "SELECT set_config('log_statement', 'all', false);" -U postgres; fi @@ -27,10 +23,8 @@ install: - if [[ "$DB" == "mysql" ]]; then mysql -e "CREATE DATABASE shimmie;" -uroot; fi script: - - php tests/test_info.php - - curl http://127.0.0.1/tests/test_info.php - - php tests/test_install.php -d $DB -h "http://127.0.0.1/" - - php tests/test_all.php -h "http://127.0.0.1/" + - php tests/install.php -d $DB -h "http://127.0.0.1:8080/" + - php tests/all.php -h "http://127.0.0.1:8080/" # If a failure occured then dump out a bunch of logs for debugging purposes. after_failure: @@ -38,9 +32,7 @@ after_failure: - sudo ls -al data/config/ - sudo cat data/config/shimmie.conf.php - sudo cat data/config/extensions.conf.php - - sudo cat /etc/nginx/sites-enabled/default - - sudo cat /var/log/nginx/error.log - - sudo cat /var/log/php5-fpm.log + - sudo cat data/php.log - sudo ls /var/run/mysql* - sudo ls /var/log/*mysql* - sudo cat /var/log/mysql.err diff --git a/tests/test_all.php b/tests/all.php similarity index 97% rename from tests/test_all.php rename to tests/all.php index 9fb49de9..59a687f4 100644 --- a/tests/test_all.php +++ b/tests/all.php @@ -8,6 +8,8 @@ * @copyright Copyright (c) 2014, jgen */ +if(PHP_SAPI !== 'cli') die('cli only'); + require_once('lib/simpletest/unit_tester.php'); require_once('lib/simpletest/web_tester.php'); require_once('lib/simpletest/reporter.php'); @@ -59,14 +61,14 @@ $page = class_exists("CustomPage") ? new CustomPage() : new Page(); $user = _get_user(); send_event(new InitExtEvent()); -// Put the database into autocommit mode for making the users. -$database->commit(); - // Create the necessary users for the tests. $userPage = new UserPage(); $userPage->onUserCreation(new UserCreationEvent("demo", "demo", "")); $userPage->onUserCreation(new UserCreationEvent("test", "test", "")); +// Commit the users. +$database->commit(); + // Fire off the InitExtEvent() again after we have made the users. $page = class_exists("CustomPage") ? new CustomPage() : new Page(); $user = _get_user(); diff --git a/tests/test_install.php b/tests/install.php similarity index 98% rename from tests/test_install.php rename to tests/install.php index b8b78f3b..86dddf1d 100644 --- a/tests/test_install.php +++ b/tests/install.php @@ -8,6 +8,8 @@ * @copyright Copyright (c) 2014, jgen */ +if(PHP_SAPI !== 'cli') die('cli only'); + require_once('lib/simpletest/unit_tester.php'); require_once('lib/simpletest/web_tester.php'); require_once('lib/simpletest/reporter.php'); @@ -66,7 +68,6 @@ class ShimmieInstallerTest extends WebTestCase { $this->clickSubmit("Go!"); if (!$this->assertText("Installation Succeeded!")) { - print "ERROR --- '" . $db . "'"; $this->showSource(); } } diff --git a/tests/router.php b/tests/router.php index 99edbcc5..e42dfaa5 100644 --- a/tests/router.php +++ b/tests/router.php @@ -1,9 +1,6 @@ -# @license http://opensource.org/licenses/GPL-2.0 GNU General Public License v2 -# - -# Exit immediately if a command exits with a non-zero status. -set -e - -# Install the necessary packages -sudo apt-get install -y nginx php5-fpm php5-mysql php5-pgsql php5-sqlite --fix-missing - -# Stop the daemons -sudo service nginx stop -sudo /etc/init.d/php5-fpm stop - -# shimmie needs to be able to create directories for images, etc. -# (permissions of 777 are bad, but it definitely works) -sudo chmod -R 0777 $1 - -NGINX_CONF="/etc/nginx/sites-enabled/default" - -# nginx configuration -echo " -server { - listen 80; - server_name localhost 127.0.0.1 \"\"; - server_tokens off; - root $1; - index index.php; - - location / { - index index.php; - # For the Nice URLs in Shimmie. - if (!-e \$request_filename) { - rewrite ^(.*)\$ /index.php?q=\$1 last; - break; - } - } - - location ~ \.php\$ { - try_files \$uri =404; - fastcgi_index index.php; - fastcgi_pass 127.0.0.1:9000; - include fastcgi_params; - } -} -" | sudo tee $NGINX_CONF > /dev/null - -# Start daemons -sudo /etc/init.d/php5-fpm start -sudo service nginx start diff --git a/tests/test_info.php b/tests/test_info.php deleted file mode 100644 index f05b184e..00000000 --- a/tests/test_info.php +++ /dev/null @@ -1,6 +0,0 @@ -