using system php-fpm always gets us php5.3 ~_~

This commit is contained in:
Shish 2015-08-01 14:25:53 +01:00
parent 21a1b176c6
commit 4f413e7386
6 changed files with 16 additions and 85 deletions

View file

@ -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

View file

@ -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();

View file

@ -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();
}
}

View file

@ -1,9 +1,6 @@
<?php
// custom routing for stand-alone mode
if(php_sapi_name() != 'cli-server') {
die('local testing only');
}
if(PHP_SAPI !== 'cli-server') die('cli only');
// warehouse files
$matches = array();
@ -13,12 +10,12 @@ if(preg_match('/\/_(images|thumbs)\/([0-9a-f]{32}).*$/', $_SERVER["REQUEST_URI"]
return true;
}
// static files
if(preg_match('/\.(?:png|jpg|jpeg|gif|css|js)$/', $_SERVER["REQUEST_URI"])) {
// use the default handler (serve static files, interpret php files)
if(preg_match('/\.(?:png|jpg|jpeg|gif|css|js|php)(\?.*)?$/', $_SERVER["REQUEST_URI"])) {
return false;
}
// all other requests
// all other requests (use shimmie routing based on URL)
$_SERVER["PHP_SELF"] = '/';
$_GET['q'] = $_SERVER["REQUEST_URI"];
require_once "index.php";

View file

@ -1,55 +0,0 @@
#!/bin/bash
#
# Set up the Travis-CI test environment for Shimmie.
# (this script should be run as root via sudo)
#
# @author jgen <jeffgenovy@gmail.com>
# @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

View file

@ -1,6 +0,0 @@
<?php
print("Shimmie Auto-Test\n");
print("~~~~~~~~~~~~~~~~~\n");
print("Database : " . getenv("DB") . "\n");
print("PHP : " . phpversion() . "\n");
print("PDO drivers: " . var_export(PDO::getAvailableDrivers(), true) . "\n");