Merge pull request #115 from javigomez/travis55b

Fix Apache running on PHP 5.3 instead of 5.5
This commit is contained in:
Viktor Vogel 2015-10-30 17:49:37 +01:00
commit e1163303bd
3 changed files with 58 additions and 19 deletions

View File

@ -2,23 +2,28 @@ language: php
php:
- 5.5
- 5.6
- 7.0
matrix:
allow_failures:
- php: 5.6
- php: 7.0
before_script:
- sudo apt-get update -qq
# Install Apache
- sudo apt-get install -y --force-yes apache2 libapache2-mod-php5 php5-curl php5-mysql php5-intl php5-gd > /dev/null
- sudo /etc/init.d/apache2 stop
- sudo sed -i -e "s,APACHE_RUN_USER=www-data,APACHE_RUN_USER=$USER,g" /etc/apache2/envvars
- sudo sed -i -e "s,APACHE_RUN_GROUP=www-data,APACHE_RUN_GROUP=$USER,g" /etc/apache2/envvars
- sudo chown -R $USER /var/lock/apache2
- sudo chown -R $USER:$USER /var/www
- ln -s $TRAVIS_BUILD_DIR/tests/ /var/www/tests
- sudo sed -i -e "s,AllowOverride[ ]None,AllowOverride All,g" /etc/apache2/sites-available/default
- sudo /etc/init.d/apache2 start
- sudo apt-get install -y --force-yes apache2 libapache2-mod-fastcgi php5-curl php5-mysql php5-intl php5-gd > /dev/null
- sudo mkdir $(pwd)/.run
- sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf
- sudo sed -e "s,listen = 127.0.0.1:9000,listen = /tmp/php5-fpm.sock,g" --in-place ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf
- sudo sed -e "s,;listen.owner = nobody,listen.owner = $USER,g" --in-place ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf
- sudo sed -e "s,;listen.group = nobody,listen.group = $USER,g" --in-place ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf
- sudo sed -e "s,;listen.mode = 0660,listen.mode = 0666,g" --in-place ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf
- sudo sed -e "s,user = nobody,;user = $USER,g" --in-place ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf
- sudo sed -e "s,group = nobody,;group = $USER,g" --in-place ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf
- cat ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf
- sudo a2enmod rewrite actions fastcgi alias
- echo "cgi.fix_pathinfo = 1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
- ~/.phpenv/versions/$(phpenv version-name)/sbin/php-fpm
- sudo cp -f tests/travis-ci-apache.conf /etc/apache2/sites-available/default
- sudo sed -e "s?%TRAVIS_BUILD_DIR%?$(pwd)?g" --in-place /etc/apache2/sites-available/default
- git submodule update --init --recursive
- sudo service apache2 restart
# Xvfb
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
@ -27,8 +32,9 @@ before_script:
- sudo apt-get install fluxbox -y --force-yes
- fluxbox &
- sleep 3 # give fluxbox some time to start
# Composer
- composer install
script:
- mv tests/acceptance.suite.dist.yml tests/acceptance.suite.yml
- vendor/bin/robo run:tests
- vendor/bin/robo run:tests true

View File

@ -37,12 +37,11 @@ class RoboFile extends \Robo\Tasks
/**
* Executes all the Selenium System Tests in a suite on your machine
*
* @param string $seleniumPath Optional path to selenium-standalone-server-x.jar
* @param string $suite Optional, the name of the tests suite
* @param bool $use_htaccess Renames and enable embedded Joomla .htaccess file
*
* @return mixed
*/
public function runTests($seleniumPath = null, $suite = 'acceptance')
public function runTests($use_htaccess = false)
{
$this->configuration = $this->getConfiguration();
@ -50,7 +49,7 @@ class RoboFile extends \Robo\Tasks
$this->setExecExtension();
$this->createTestingSite();
$this->createTestingSite($use_htaccess);
$this->getComposer();
@ -166,8 +165,10 @@ class RoboFile extends \Robo\Tasks
/**
* Creates a testing Joomla site for running the tests (use it before run:test)
*
* @param bool $use_htaccess (1/0) Rename and enable embedded Joomla .htaccess file
*/
public function createTestingSite()
public function createTestingSite($use_htaccess = false)
{
if (!empty($this->configuration->skipClone))
{
@ -187,9 +188,15 @@ class RoboFile extends \Robo\Tasks
$this->taskDeleteDir($this->cmsPath)->run();
}
// Copy cache to the testing folder
$this->_copyDir('tests/cache', $this->cmsPath);
$this->say('Joomla CMS site created at ' . $this->cmsPath);
// Optionally uses Joomla default htaccess file. Used by TravisCI
if ($use_htaccess == true)
{
$this->_copy('/tests/joomla-cms3/htaccess.txt', 'tests/joomla-cms3/.htaccess');
$this->_exec('sed -e "s,# RewriteBase /,RewriteBase /tests/joomla-cms3/,g" --in-place tests/joomla-cms3/.htaccess');
}
}
/**

View File

@ -0,0 +1,26 @@
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot %TRAVIS_BUILD_DIR%
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory "%TRAVIS_BUILD_DIR%">
Options FollowSymLinks MultiViews ExecCGI
AllowOverride All
Order deny,allow
Allow from all
</Directory>
# Wire up Apache to use Travis CI's php-fpm.
<IfModule mod_fastcgi.c>
AddHandler php5-fcgi .php
Action php5-fcgi /php5-fcgi
Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi
FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -socket /tmp/php5-fpm.sock -pass-header Authorization
</IfModule>
ErrorLog ${APACHE_LOG_DIR}/error.log
</VirtualHost>