Better Travis CI

NEW:
Cleaned up routines for better readability of both declaration and results.
PHP versions now really covered.
    The old code forced install of PHP and didn't use Travis provided versions.
    This resulted in the process not being executed with the declared PHP version.
Dropped MySQL in favor of MariaDB.
    This is now the FLOSS community standard.
    This should help avoid problems with buggy MySQL releases.
Fast finish enabled to show results faster.
Optimized tools installation with composer.
    The right version of the tool is installed for the PHP version under test.
New PHP linter to check for syntax errors.
    Parallelized for better speed.
Apache + PHP FPM for testing webservices.
    The previous mod_php configuration was not supported on Travis.
New global DEBUG environment variable to show verbose output with configuration files content.
IRC notification on #dolibarr@freenode for community awareness.

FIXES:
Bug in scripts preventing execution with environmentalized PHP.
Wrong detection of MAIN_URL_ROOT under specific circumstances.
    $_SERVER["DOCUMENT_ROOT"] empty and $_SERVER["SCRIPT_NAME"] populated.
Relative ignore directive in coding style ruleset to avoid bypassing test.
Unit test errors without an exit status.
    This prevented the CI from properly detecting and reporting the error.

TODOS:
PostgreSQL support.
    This one is tricky since we only have a MySQL dump and the syntax is not directly compatible.
SQLite support.
    Disabled in core at the moment.
Nginx + PHP FPM support.
    Test webservices on the second most popular webserver.
Run dev/* checks.
    We have a nice collection of scripts we could leverage.
Check Javascript.
Check CSS.
Check SQL.
This commit is contained in:
Raphaël Doursenaud 2015-12-11 05:08:32 +01:00
parent dc6ec91b2c
commit bbe7498de6
48 changed files with 366 additions and 207 deletions

View File

@ -1,154 +1,308 @@
# This script is used by Travis CI to run automatically Continuous test integration # This script is used by Travis CI to run automatically Continuous test integration
# from Dolibarr GitHub repository. # from Dolibarr GitHub repository.
# Command run is phpunit
# For syntax, see http://about.travis-ci.org/docs/user/languages/php/ # For syntax, see http://about.travis-ci.org/docs/user/languages/php/
sudo: required
language: php
php:
- '5.3'
- '5.4'
- '5.5'
- '5.6'
- '7.0'
- nightly
addons:
mariadb: '10.0'
# FIXME: find a way to import a MySQL dump into PostgreSQL
#postgresql: '9.3'
apt:
packages:
# We need a webserver to test the webservices
# Let's install Apache with.
- apache2
# mod_php is not supported by Travis. Add fcgi. We install FPM later on.
- libapache2-mod-fastcgi
# Start on every boot
services:
- memcached
env:
global:
# Set to true for very verbose output
- DEBUG=false
matrix:
# MariaDB overrides MySQL installation so it's not possible to test both yet
#- DB=mysql
- DB=mariadb
# FIXME: find a way to import a MySQL dump into PostgreSQL
#- DB=postgresql
# TODO
#- DB=sqlite
# See https://docs.travis-ci.com/user/languages/php/#Apache-%2B-PHP
#- WS=apache
# See https://github.com/DracoBlue/travis-ci-nginx-php-fpm-test
#- WS=nginx
matrix:
fast_finish: true
allow_failures:
- php: '7.0'
- php: nightly
# FIXME
#- env: DB=postgresql
# TODO
#- env: DB=sqlite
notifications: notifications:
email: email:
on_success: never # [always|never|change] default: change on_success: never # [always|never|change] default: change
on_failure: change # [always|never|change] default: always on_failure: change # [always|never|change] default: always
irc:
addons: channels:
postgresql: "9.3" - "chat.freenode.net#dolibarr"
on_success: change
on_failure: always
use_notice: true
services: before_install:
- memcached # will start memcached - |
echo "Disabling Xdebug for composer"
export PHP_VERSION_NAME=$(phpenv version-name)
cp ~/.phpenv/versions/$PHP_VERSION_NAME/etc/conf.d/xdebug.ini /tmp/xdebug.ini
phpenv config-rm xdebug.ini
echo
# This will tell travis to run phpunit install:
language: php - |
php: echo "Updating Composer"
- 5.3 composer self-update
- 5.4 echo
- 5.5
- 5.6
- 7.0
matrix: - |
allow_failures: echo "Installing Parallel Lint"
- php: 7.0 composer -n require jakub-onderka/php-parallel-lint ^0
composer -n require jakub-onderka/php-console-highlighter ^0
echo
env: - |
- DB=mysql echo "Installing PHP Unit"
# - DB=postgres if [ "$TRAVIS_PHP_VERSION" = '5.3' ] || [ "$TRAVIS_PHP_VERSION" = '5.4' ] || [ "$TRAVIS_PHP_VERSION" = '5.5' ]; then
composer -n require phpunit/phpunit ^4
fi
if [ "$TRAVIS_PHP_VERSION" = '5.6' ] || [ "$TRAVIS_PHP_VERSION" = '7.0' ] || [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then
composer -n require phpunit/phpunit ^5
fi
echo
before_script: - |
- echo Start travis echo "Installing PHP CodeSniffer"
- echo Current dir is `pwd` composer require squizlabs/php_codesniffer ^2
- echo Home dir is `echo ~` echo
- export PHPV=`phpenv version-name`
- echo PHP version $PHPV
# - echo Update composer
# - ~/.phpenv/versions/$(phpenv version-name)/bin/composer.phar self-update
- echo PHPUnit version
- which phpunit
- phpunit --version
- echo Install phpcs then show installed rules
- cp composer.json composer.json.old
- cp composer.json.phpcs composer.json
- composer self-update
- composer require squizlabs/php_codesniffer:"^2.0.0"
- composer install
- phpenv rehash
- htdocs/includes/squizlabs/php_codesniffer/scripts/phpcs --version
- htdocs/includes/squizlabs/php_codesniffer/scripts/phpcs -i
# - which phpcs
# - phpcs --version
# - phpcs -i
- echo Create dir $(pwd)/htdocs/documents
- sudo mkdir -p $(pwd)/htdocs/documents/admin/temp;
- sudo touch $(pwd)/htdocs/documents/dolibarr.log;
- sudo chmod a+rwx /home; sudo chmod a+rwx /home/travis; sudo chmod -R a+rwx /home/travis/build;
- sudo chmod -R a+rwx $(pwd);
- sudo chown -R www-data:travis $(pwd)/htdocs/documents;
- find $(pwd)/htdocs/documents -type d -exec ls -alt {} \;
- echo Edit php.ini file
- echo 'date.timezone = "Europe/Paris"' >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
# - echo "extension = memcache.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
- echo "extension = memcached.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
- sh -c "if [ '$PHPV' = '5.3' ]; then echo 'extension = apc.so' >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi"
- sh -c "if [ '$PHPV' = '5.4' ]; then echo 'extension = apc.so' >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi"
- sh -c "if [ '$PHPV' = '5.3' ]; then echo 'zend_extension_ts = xdebug.so' >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi"
- sh -c "if [ '$PHPV' = '5.4' ]; then echo 'zend_extension_ts = xdebug.so' >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi"
- cat ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
- echo Mysql version
# INSTALL MYSQL 5.6
# (https://github.com/piwik/piwik/commit/20bd2e1c24e5d673dce3feb256204ad48c29f160)
# TODO: Remove when mysql 5.6 is provided by travis.
# Otherwise, our migrations will raise a syntax error.
# - "sudo apt-get remove mysql-common mysql-server-5.5 mysql-server-core-5.5 mysql-client-5.5 mysql-client-core-5.5"
# - "sudo apt-get autoremove"
# - "sudo apt-get install libaio1"
# - "wget -O mysql-5.6.14.deb http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.14-debian6.0-x86_64.deb/from/http://cdn.mysql.com/"
# - "sudo dpkg -i mysql-5.6.14.deb"
# - "sudo cp /opt/mysql/server-5.6/support-files/mysql.server /etc/init.d/mysql.server"
# - "sudo ln -s /opt/mysql/server-5.6/bin/* /usr/bin/"
# - "sudo sed -i'' 's/table_cache/table_open_cache/' /etc/mysql/my.cnf"
# - "sudo sed -i'' 's/log_slow_queries/slow_query_log/' /etc/mysql/my.cnf"
# - "sudo sed -i'' 's/basedir[^=]\\+=.*$/basedir = \\/opt\\/mysql\\/server-5.6/' /etc/mysql/my.cnf"
# - "sudo /etc/init.d/mysql.server start"
# /END MYSQL 5.6- mysql --version
- mysql --version
- mysql -e "SELECT VERSION();"
- echo Init database
- sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'DROP DATABASE IF EXISTS myapp_test;' -U postgres; fi"
- sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'CREATE DATABASE myapp_test;' -U postgres; fi"
- sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'DROP DATABASE IF EXISTS myapp_test;'; fi"
- sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'CREATE DATABASE IF NOT EXISTS myapp_test;'; fi"
- sh -c "if [ '$DB' = 'mysql' ]; then mysql -D myapp_test < $(pwd)/dev/initdata/mysqldump_dolibarr_3.5.0.sql; fi"
- echo Create config file htdocs/conf/conf.php
- echo '<?php ' > htdocs/conf/conf.php
- sh -c "if [ '$DB' = 'pgsql' ]; then echo '$'dolibarr_main_db_type=\'pgsql\'';' >> htdocs/conf/conf.php; fi"
- sh -c "if [ '$DB' = 'mysql' ]; then echo '$'dolibarr_main_db_type=\'mysqli\'';' >> htdocs/conf/conf.php; fi"
- echo '$'dolibarr_main_url_root=\'http://localhost/\'';' >> htdocs/conf/conf.php
- echo '$'dolibarr_main_document_root=\'$(pwd)/htdocs\'';' >> htdocs/conf/conf.php
- echo '$'dolibarr_main_data_root=\'$(pwd)/htdocs/documents\'';' >> htdocs/conf/conf.php
- echo '$'dolibarr_main_db_host=\'localhost\'';' >> htdocs/conf/conf.php
- echo '$'dolibarr_main_db_name=\'myapp_test\'';' >> htdocs/conf/conf.php
- echo '$'dolibarr_main_db_user=\'travis\'';' >> htdocs/conf/conf.php
- echo '$'dolibarr_main_authentication=\'dolibarr\'';' >> htdocs/conf/conf.php
- echo '?>' >> htdocs/conf/conf.php
- echo Show conf.php content
- cat htdocs/conf/conf.php
- echo Install apache server
- sudo apt-get update
- sudo apt-get install -y --force-yes apache2 libapache2-mod-php5 php5-curl php5-mysql php5-pgsql php5-intl
- sudo sed -i -e "s,/var/www,$(pwd)/htdocs,g" /etc/apache2/sites-available/default
- echo Show default virtual host
- sudo cat /etc/apache2/sites-available/default
- sudo /etc/init.d/apache2 restart
- wget http://localhost/
- sudo cat /etc/apache2/envvars
- sudo cat /var/log/apache2/error.log
- cat index.html
- |
echo "Adding Composer binaries to the path"
export PATH="$TRAVIS_BUILD_DIR/htdocs/includes/bin:$PATH"
echo
before_script:
- |
echo "Re-enabling Xdebug for PHP CodeSniffer and PHP Unit"
phpenv config-add /tmp/xdebug.ini
echo
script: - |
- cd htdocs/install echo "Setting up PHP"
- date echo
# - php upgrade.php 3.4.0 3.5.0 ignoredbversion > upgrade340350.log echo "Set timezone"
# - php upgrade2.php 3.4.0 3.5.0 ignoredbversion > upgrade340350-2.log echo 'date.timezone = "Europe/Paris"' >> ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php.ini
- php upgrade.php 3.5.0 3.6.0 ignoredbversion > upgrade350360.log if [ "$TRAVIS_PHP_VERSION" = '5.3' ] || [ "$TRAVIS_PHP_VERSION" = '5.4' ]; then
- php upgrade2.php 3.5.0 3.6.0 ignoredbversion > upgrade350360-2.log echo
- php upgrade.php 3.6.0 3.7.0 ignoredbversion > upgrade360370.log echo "Enabling APC for PHP <= 5.4"
- php upgrade2.php 3.6.0 3.7.0 ignoredbversion > upgrade360370-2.log # Documentation says it should be available for PHP <= 5.6 but it's not for 5.5 and 5.6!
- php upgrade.php 3.7.0 3.8.0 ignoredbversion > upgrade370380.log echo 'extension = apc.so' >> ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php.ini
# - cat upgrade370380.log echo
- php upgrade2.php 3.7.0 3.8.0 ignoredbversion > upgrade370380-2.log echo "Enabling Memcached for PHP <= 5.4"
- php upgrade.php 3.8.0 3.9.0 ignoredbversion > upgrade380390.log # Documentation says it should be available for all PHP versions but it's not for 5.5 and 5.6, 7.0 and nightly!
# - cat upgrade380390.log echo 'extension = memcached.so' >> ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php.ini
- php upgrade2.php 3.8.0 3.9.0 ignoredbversion > upgrade380390-2.log fi
# - cat upgrade380390-2.log phpenv rehash
- cd ../.. echo
- date
- phpunit -d memory_limit=-1 --configuration test/phpunit/phpunittest.xml test/phpunit/AllTests.php - |
- date if [ "$DEBUG" = true ]; then
# - phpcs -p --warning-severity=0 -s --report-summary --standard=dev/codesniffer/ruleset.xml --tab-width=4 --ignore=/build/html/,/dev/vagrant/,/documents/,/includes/,/test/report/ htdocs/core/class/dolgraph.class.php 2>&1 echo "Debugging informations"
- htdocs/includes/squizlabs/php_codesniffer/scripts/phpcs -p --warning-severity=0 -s --report-checkstyle --report-summary --standard=dev/codesniffer/ruleset.xml --tab-width=4 --ignore=/htdocs/conf/conf.php,/build/html/,/dev/vagrant/,/documents/,/includes/,/test/report/ . 2>&1 # Check PHP
- date php -i
# Check PHP CodeSniffer installation
which phpcs
phpcs --version
phpcs -i
# Check PHPUnit installation
which phpunit
phpunit --version
# Check MySQL
mysql --version
mysql -e "SELECT VERSION();"
echo
fi
- |
echo "Setting up database"
if [ "$DB" = 'mysql' ] || [ "$DB" = 'mariadb' ]; then
echo "MySQL"
mysql -e 'DROP DATABASE IF EXISTS travis;'
mysql -e 'CREATE DATABASE IF NOT EXISTS travis;'
mysql -D travis < dev/initdata/mysqldump_dolibarr_3.5.0.sql
fi
# FIXME: find a way to import a MySQL dump into PostgreSQL
#if [ "$DB" = 'postgresql' ]; then
# pgsql travis < dev/initdata/mysqldump_dolibarr_3.5.0.sql
#fi
# TODO: SQLite
echo
- |
echo "Setting up Dolibarr"
export CONF_FILE=htdocs/conf/conf.php
echo '<?php ' > $CONF_FILE
echo '$'dolibarr_main_url_root=\'http://127.0.0.1\'';' >> $CONF_FILE
echo '$'dolibarr_main_document_root=\'$TRAVIS_BUILD_DIR/htdocs\'';' >> $CONF_FILE
echo '$'dolibarr_main_data_root=\'$TRAVIS_BUILD_DIR/documents\'';' >> $CONF_FILE
echo '$'dolibarr_main_db_host=\'127.0.0.1\'';' >> $CONF_FILE
echo '$'dolibarr_main_db_name=\'travis\'';' >> $CONF_FILE
echo '$'dolibarr_main_db_user=\'travis\'';' >> $CONF_FILE
if [ "$DB" = 'mysql' ] || [ "$DB" = 'mariadb' ]; then
echo '$'dolibarr_main_db_type=\'mysqli\'';' >> $CONF_FILE
fi
# FIXME
#if [ "$DB" = 'postgresql' ]; then
# echo '$'dolibarr_main_db_type=\'pgsql\'';' >> $CONF_FILE
#fi
# TODO: SQLite
echo '$'dolibarr_main_authentication=\'dolibarr\'';' >> $CONF_FILE
echo
- |
if [ "$DEBUG" = true ]; then
echo "Debugging informations"
cat $CONF_FILE
echo
fi
- |
echo "Create documents directory and set permissions"
# and admin/temp subdirectory needed for unit tests
mkdir -p documents/admin/temp
echo
- |
echo "Setting up Apache + FPM"
# enable php-fpm
cp ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php-fpm.conf.default ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php-fpm.conf
if [ "$TRAVIS_PHP_VERSION" = '7.0' ] || [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then
# Copy the included pool
cp ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php-fpm.d/www.conf.default ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php-fpm.d/www.conf
fi
if [ "$DEBUG" = true ]; then
cat ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php-fpm.conf
fi
sudo a2enmod rewrite actions fastcgi alias
echo "cgi.fix_pathinfo = 1" >> ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php.ini
if [ "$DEBUG" = true ]; then
cat ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php.ini
fi
~/.phpenv/versions/$PHP_VERSION_NAME/sbin/php-fpm
# configure apache virtual hosts
sudo cp -f build/travis-ci/apache.conf /etc/apache2/sites-available/default
sudo sed -e "s?%TRAVIS_BUILD_DIR%?$TRAVIS_BUILD_DIR?g" --in-place /etc/apache2/sites-available/default
if [ "$DEBUG" = true ]; then
sudo cat /etc/apache2/sites-available/default
fi
sudo service apache2 restart
echo
script:
- |
echo "Checking webserver availability"
# Ensure we catch errors
set -e
wget http://127.0.0.1
if [ "$DEBUG" = true ]; then
cat index.html
fi
set +e
echo
- |
echo "Checking PHP syntax errors"
# Ensure we catch errors
set -e
parallel-lint --exclude htdocs/includes --blame .
set +e
echo
# TODO: dev/* checks
- |
echo "Checking coding style"
# Ensure we catch errors
set -e
# Exclusions are defined in the ruleset.xml file
phpcs -s -n -p -d memory_limit=-1 --colors --tab-width=4 --standard=dev/codesniffer/ruleset.xml --encoding=utf-8 .
set +e
echo
# TODO: Check Javascript (jshint?)
# TODO: Check CSS (csslint?)
# TODO: check SQL syntax (pgsanity?)
- |
echo "Upgrading Dolibarr"
# Ensure we catch errors
set -e
cd htdocs/install
php upgrade.php 3.5.0 3.6.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade350360.log
php upgrade2.php 3.5.0 3.6.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade350360-2.log
php upgrade.php 3.6.0 3.7.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade360370.log
php upgrade2.php 3.6.0 3.7.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade360370-2.log
php upgrade.php 3.7.0 3.8.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade370380.log
php upgrade2.php 3.7.0 3.8.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade370380-2.log
php upgrade.php 3.8.0 3.9.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade380390.log
php upgrade2.php 3.8.0 3.9.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade380390-2.log
cd -
set +e
echo
- |
echo "Unit testing"
# Ensure we catch errors
set -e
phpunit -d memory_limit=-1 -c test/phpunit/phpunittest.xml test/phpunit/AllTests.php
set +e
echo
after_success:
after_failure:
- |
if [ "$DEBUG" = true ]; then
echo "Debugging informations"
# Upgrade log files
cat *.log
# Dolibarr log file
cat documents/dolibarr.log
# Apache log file
sudo cat /var/log/apache2/error.log
# MariaDB log file
sudo cat /var/log/mysql/error.log
# TODO: PostgreSQL log file
echo
fi
after_script: after_script:
# - echo Output dolibarr log file; cat $(pwd)/htdocs/documents/dolibarr.log
- echo Output apache log file; sudo cat /var/log/apache2/error.log
- echo End travis

View File

@ -1,4 +1,4 @@
#!/usr/bin/php #!/usr/bin/env php
<?php <?php
/*----------------------------------------------------- /*-----------------------------------------------------
* *

View File

@ -1,4 +1,4 @@
#!/usr/bin/php #!/usr/bin/env php
<?php <?php
/* Copyright (C) 2015 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2015 Laurent Destailleur <eldy@users.sourceforge.net>
* *

View File

@ -0,0 +1,18 @@
<VirtualHost *:80>
DocumentRoot %TRAVIS_BUILD_DIR%/htdocs
<Directory "%TRAVIS_BUILD_DIR%/htdocs">
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 -host 127.0.0.1:9000 -pass-header Authorization
</IfModule>
</VirtualHost>

View File

@ -1,18 +0,0 @@
{
"name": "dolibarr/dolibarr",
"type": "project",
"description": "Dolibarr ERP & CRM is a modern and easy to use web software to manage your business",
"keywords": ["erp","crm","invoice","sme","proposal","order","stock"],
"homepage": "http://www.dolibarr.org",
"license": "GPL-3.0+",
"support": {
"issues": "https://github.com/Dolibarr/dolibarr/issues",
"forum": "http://www.dolibarr.org/forum",
"wiki": "http://wiki.dolibarr.org",
"irc": "irc://chat.freenode.net/dolibarr",
"source": "https://github.com/Dolibarr/dolibarr"
},
"config": {
"vendor-dir": "htdocs/includes"
}
}

View File

@ -3,12 +3,12 @@
<ruleset name="Dolibarr"> <ruleset name="Dolibarr">
<description>Dolibarr coding standard.</description> <description>Dolibarr coding standard.</description>
<exclude-pattern>*/conf.php</exclude-pattern> <exclude-pattern type="relative">build/html</exclude-pattern>
<exclude-pattern>*/includes/*</exclude-pattern> <exclude-pattern type="relative">documents</exclude-pattern>
<exclude-pattern>*/documents/*</exclude-pattern> <exclude-pattern type="relative">htdocs/custom</exclude-pattern>
<exclude-pattern>*/dev/vagrant/*</exclude-pattern> <exclude-pattern type="relative">htdocs/includes</exclude-pattern>
<exclude-pattern>*/custom/*</exclude-pattern> <exclude-pattern type="relative">htdocs/conf.php</exclude-pattern>
<exclude-pattern>*/nltechno*</exclude-pattern> <exclude-pattern type="relative">*/nltechno*</exclude-pattern>
<!-- List of all tests --> <!-- List of all tests -->

View File

@ -1,4 +1,4 @@
#!/usr/bin/php #!/usr/bin/env php
<?php <?php
/* Copyright (C) 2009 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2009 Laurent Destailleur <eldy@users.sourceforge.net>
* *

View File

@ -1,4 +1,4 @@
#!/usr/bin/php #!/usr/bin/env php
<?php <?php
/* Copyright (C) 2009 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2009 Laurent Destailleur <eldy@users.sourceforge.net>
* *

View File

@ -1,4 +1,4 @@
#!/usr/bin/php #!/usr/bin/env php
<?php <?php
/* Copyright (C) 2009 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2009 Laurent Destailleur <eldy@users.sourceforge.net>
* *

View File

@ -1,4 +1,4 @@
#!/usr/bin/php #!/usr/bin/env php
<?php <?php
/* Copyright (C) 2009 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2009 Laurent Destailleur <eldy@users.sourceforge.net>
* *

View File

@ -1,4 +1,4 @@
#!/usr/bin/php #!/usr/bin/env php
<?php <?php
/* Copyright (C) 2009 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2009 Laurent Destailleur <eldy@users.sourceforge.net>
* *

View File

@ -1,4 +1,4 @@
#!/usr/bin/php #!/usr/bin/env php
<?php <?php
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* *

View File

@ -1,4 +1,4 @@
#!/usr/bin/php #!/usr/bin/env php
<?php <?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>

View File

@ -1,4 +1,4 @@
#!/usr/bin/php #!/usr/bin/env php
<?php <?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>

View File

@ -1,4 +1,4 @@
#!/usr/bin/php #!/usr/bin/env php
<?php <?php
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2007 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2007 Laurent Destailleur <eldy@users.sourceforge.net>

View File

@ -1,4 +1,4 @@
#!/usr/bin/php #!/usr/bin/env php
<?php <?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2006-2013 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2006-2013 Laurent Destailleur <eldy@users.sourceforge.net>

View File

@ -1,4 +1,4 @@
#!/usr/bin/php #!/usr/bin/env php
<?php <?php
/* Copyright (C) 2012 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2012 Laurent Destailleur <eldy@users.sourceforge.net>
* *

View File

@ -1,4 +1,4 @@
#!/usr/bin/php #!/usr/bin/env php
<?php <?php
/* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr> /* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* *

View File

@ -1,4 +1,4 @@
#!/usr/bin/php #!/usr/bin/env php
<?php <?php
/* Copyright (C) 2008-2014 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2008-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* *

View File

@ -1,4 +1,4 @@
#!/usr/bin/php #!/usr/bin/env php
<?php <?php
/* Copyright (C) 2009 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2009 Laurent Destailleur <eldy@users.sourceforge.net>
* *

View File

@ -1,4 +1,4 @@
#!/usr/bin/php #!/usr/bin/env php
<?php <?php
/* Copyright (C) 2007-2013 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2007-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) ---Put here your own copyright and developer email--- * Copyright (C) ---Put here your own copyright and developer email---

View File

@ -1,4 +1,4 @@
#!/usr/bin/php #!/usr/bin/env php
<?php <?php
/* Copyright (C) 2009-2012 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2009-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* *

View File

@ -1,4 +1,4 @@
#!/usr/bin/php #!/usr/bin/env php
<?php <?php
/* Copyright (c) 2015 Tommaso Basilici <t.basilici@19.coop> /* Copyright (c) 2015 Tommaso Basilici <t.basilici@19.coop>
* Copyright (c) 2015 Laurent Destailleur <eldy@destailleur.fr> * Copyright (c) 2015 Laurent Destailleur <eldy@destailleur.fr>

View File

@ -1,4 +1,4 @@
#!/usr/bin/php #!/usr/bin/env php
<?php <?php
/* Copyright (C) 2014 by FromDual GmbH, licensed under GPL v2 /* Copyright (C) 2014 by FromDual GmbH, licensed under GPL v2
* Copyright (C) 2014 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2014 Laurent Destailleur <eldy@users.sourceforge.net>

View File

@ -166,7 +166,11 @@ define('DOL_DOCUMENT_ROOT', $dolibarr_main_document_root); // Filesystem core
$tmp=''; $tmp='';
$found=0; $found=0;
$real_dolibarr_main_document_root=str_replace('\\','/',realpath($dolibarr_main_document_root)); // A) Value found into config file, to say where are store htdocs files. Ex: C:/xxx/dolibarr, C:/xxx/dolibarr/htdocs $real_dolibarr_main_document_root=str_replace('\\','/',realpath($dolibarr_main_document_root)); // A) Value found into config file, to say where are store htdocs files. Ex: C:/xxx/dolibarr, C:/xxx/dolibarr/htdocs
$pathroot=$_SERVER["DOCUMENT_ROOT"]; // B) Value reported by web server setup, to say where is root of web server instance. Ex: C:/xxx/dolibarr, C:/xxx/dolibarr/htdocs if (!empty($_SERVER["DOCUMENT_ROOT"])) {
$pathroot = $_SERVER["DOCUMENT_ROOT"]; // B) Value reported by web server setup, to say where is root of web server instance. Ex: C:/xxx/dolibarr, C:/xxx/dolibarr/htdocs
} else {
$pathroot = 'BOGUS';
}
$paths=explode('/',str_replace('\\','/',$_SERVER["SCRIPT_NAME"])); // C) Value reported by web server, to say full path on filesystem of a file. Ex: /dolibarr/htdocs/admin/system/phpinfo.php $paths=explode('/',str_replace('\\','/',$_SERVER["SCRIPT_NAME"])); // C) Value reported by web server, to say full path on filesystem of a file. Ex: /dolibarr/htdocs/admin/system/phpinfo.php
// Try to detect if $_SERVER["DOCUMENT_ROOT"]+start of $_SERVER["SCRIPT_NAME"] is $dolibarr_main_document_root. If yes, relative url to add before dol files is this start part. // Try to detect if $_SERVER["DOCUMENT_ROOT"]+start of $_SERVER["SCRIPT_NAME"] is $dolibarr_main_document_root. If yes, relative url to add before dol files is this start part.
$concatpath=''; $concatpath='';

View File

@ -1,4 +1,5 @@
<?PHP #!/usr/bin/env php
<?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com> /* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2014 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> * Copyright (C) 2013-2014 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>

View File

@ -1,4 +1,4 @@
#!/usr/bin/php #!/usr/bin/env php
<?php <?php
/* /*
* Copyright (C) 2013 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2013 Laurent Destailleur <eldy@users.sourceforge.net>

View File

@ -1,4 +1,4 @@
#!/usr/bin/php #!/usr/bin/env php
<?php <?php
/* /*
* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> * Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>

View File

@ -1,4 +1,4 @@
#!/usr/bin/php #!/usr/bin/env php
<?php <?php
/* /*
* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> * Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>

View File

@ -1,4 +1,4 @@
#!/usr/bin/php #!/usr/bin/env php
<?php <?php
/* /*
* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> * Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>

View File

@ -1,4 +1,4 @@
#!/usr/bin/php #!/usr/bin/env php
<?php <?php
/* /*
* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> * Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>

View File

@ -1,4 +1,4 @@
#!/usr/bin/php #!/usr/bin/env php
<?php <?php
/* Copyright (C) 2012 Nicolas Villa aka Boyquotes http://informetic.fr /* Copyright (C) 2012 Nicolas Villa aka Boyquotes http://informetic.fr
* Copyright (C) 2013 Florian Henry <forian.henry@open-concept.pro * Copyright (C) 2013 Florian Henry <forian.henry@open-concept.pro

View File

@ -1,4 +1,4 @@
#!/usr/bin/php #!/usr/bin/env php
<?php <?php
/* /*
* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> * Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>

View File

@ -1,4 +1,4 @@
#!/usr/bin/php #!/usr/bin/env php
<?php <?php
/* /*
* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> * Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>

View File

@ -1,4 +1,4 @@
#!/usr/bin/php #!/usr/bin/env php
<?php <?php
/* /*
* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> * Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>

View File

@ -1,4 +1,4 @@
#!/usr/bin/php #!/usr/bin/env php
<?php <?php
/* /*
* Copyright (C) 2009-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2009-2012 Laurent Destailleur <eldy@users.sourceforge.net>

View File

@ -1,4 +1,4 @@
#!/usr/bin/php #!/usr/bin/env php
<?php <?php
/** /**
* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> * Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>

View File

@ -1,4 +1,4 @@
#!/usr/bin/php #!/usr/bin/env php
<?php <?php
/** /**
* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> * Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>

View File

@ -1,4 +1,4 @@
#!/usr/bin/php #!/usr/bin/env php
<?php <?php
/* Copyright (C) 2007-2013 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2007-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2015 Jean Heimburger <http://tiaris.eu> * Copyright (C) 2015 Jean Heimburger <http://tiaris.eu>

View File

@ -1,4 +1,4 @@
#!/usr/bin/php #!/usr/bin/env php
<?php <?php
/** /**
* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> * Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>

View File

@ -1,4 +1,4 @@
#!/usr/bin/php #!/usr/bin/env php
<?php <?php
/** /**
* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> * Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>

View File

@ -1,4 +1,4 @@
#!/usr/bin/php #!/usr/bin/env php
<?php <?php
/** /**
* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> * Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>

View File

@ -1,4 +1,4 @@
#!/usr/bin/php #!/usr/bin/env php
<?php <?php
/** /**
* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> * Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>

View File

@ -1,4 +1,4 @@
#!/usr/bin/php #!/usr/bin/env php
<?php <?php
/* /*
* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> * Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>

View File

@ -36,17 +36,17 @@ require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
if ($langs->defaultlang != 'en_US') if ($langs->defaultlang != 'en_US')
{ {
print "Error: Default language for company to run tests must be set to en_US or auto. Current is ".$langs->defaultlang."\n"; print "Error: Default language for company to run tests must be set to en_US or auto. Current is ".$langs->defaultlang."\n";
exit; exit(1);
} }
if (empty($conf->adherent->enabled)) if (empty($conf->adherent->enabled))
{ {
print "Error: Module member must be enabled to have significatn results.\n"; print "Error: Module member must be enabled to have significant results.\n";
exit; exit(1);
} }
if (! empty($conf->ldap->enabled)) if (! empty($conf->ldap->enabled))
{ {
print "Error: LDAP module should not be enabled.\n"; print "Error: LDAP module should not be enabled.\n";
exit; exit(1);
} }
if (! empty($conf->google->enabled)) if (! empty($conf->google->enabled))
{ {

View File

@ -33,7 +33,7 @@ $langs->load("dict");
if ($langs->defaultlang != 'en_US') if ($langs->defaultlang != 'en_US')
{ {
print "Error: Default language for company to run tests must be set to en_US or auto. Current is ".$langs->defaultlang."\n"; print "Error: Default language for company to run tests must be set to en_US or auto. Current is ".$langs->defaultlang."\n";
exit; exit(1);
} }
if (empty($user->id)) if (empty($user->id))

View File

@ -42,7 +42,7 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1;
if (! empty($conf->global->MAIN_ROUNDING_RULE_TOT)) if (! empty($conf->global->MAIN_ROUNDING_RULE_TOT))
{ {
print "Parameter MAIN_ROUNDING_RULE_TOT must be set to 0 or not set.\n"; print "Parameter MAIN_ROUNDING_RULE_TOT must be set to 0 or not set.\n";
exit; exit(1);
} }
/** /**

View File

@ -43,7 +43,7 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1;
if (empty($conf->service->enabled)) if (empty($conf->service->enabled))
{ {
print "Error: Module service must be enabled.\n"; print "Error: Module service must be enabled.\n";
exit; exit(1);
} }
/** /**