Skip to content
Snippets Groups Projects
Commit a136e907 authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Fix travis

parent 41cdb655
No related branches found
No related tags found
No related merge requests found
...@@ -33,7 +33,7 @@ services: ...@@ -33,7 +33,7 @@ services:
env: env:
global: global:
# Set to true for very verbose output # Set to true for very verbose output
- DEBUG=true - DEBUG=false
matrix: matrix:
# MariaDB overrides MySQL installation so it's not possible to test both yet # MariaDB overrides MySQL installation so it's not possible to test both yet
#- DB=mysql #- DB=mysql
...@@ -140,22 +140,21 @@ before_script: ...@@ -140,22 +140,21 @@ before_script:
- | - |
if [ "$DEBUG" = true ]; then if [ "$DEBUG" = true ]; then
echo "Debugging informations" # Check PHP
# Check PHP php -i
php -i # Check PHP CodeSniffer installation
# Check PHP CodeSniffer installation which phpcs
which phpcs phpcs --version
phpcs --version phpcs -i
phpcs -i # Check PHPUnit installation
# Check PHPUnit installation which phpunit
which phpunit phpunit --version
phpunit --version # Check MySQL
# Check MySQL mysql --version
mysql --version mysql -e "SELECT VERSION();"
mysql -e "SELECT VERSION();" echo
echo
fi fi
- | - |
echo "Setting up database" echo "Setting up database"
if [ "$DB" = 'mysql' ] || [ "$DB" = 'mariadb' ]; then if [ "$DB" = 'mysql' ] || [ "$DB" = 'mariadb' ]; then
...@@ -172,8 +171,8 @@ before_script: ...@@ -172,8 +171,8 @@ before_script:
echo echo
- | - |
echo "Setting up Dolibarr"
export CONF_FILE=htdocs/conf/conf.php export CONF_FILE=htdocs/conf/conf.php
echo "Setting up Dolibarr $CONF_FILE"
echo '<?php ' > $CONF_FILE echo '<?php ' > $CONF_FILE
echo '$'dolibarr_main_url_root=\'http://127.0.0.1\'';' >> $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_document_root=\'$TRAVIS_BUILD_DIR/htdocs\'';' >> $CONF_FILE
...@@ -190,15 +189,9 @@ before_script: ...@@ -190,15 +189,9 @@ before_script:
#fi #fi
# TODO: SQLite # TODO: SQLite
echo '$'dolibarr_main_authentication=\'dolibarr\'';' >> $CONF_FILE echo '$'dolibarr_main_authentication=\'dolibarr\'';' >> $CONF_FILE
cat $CONF_FILE
echo echo
- |
if [ "$DEBUG" = true ]; then
echo "Debugging informations"
cat $CONF_FILE
echo
fi
- | - |
echo "Create documents directory and set permissions" echo "Create documents directory and set permissions"
# and admin/temp subdirectory needed for unit tests # and admin/temp subdirectory needed for unit tests
......
...@@ -150,7 +150,11 @@ define('DOL_DOCUMENT_ROOT', $dolibarr_main_document_root); // Filesystem core ...@@ -150,7 +150,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 = 'NOTDEFINED';
}
$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='';
...@@ -169,6 +173,7 @@ foreach($paths as $tmppath) // We check to find (B+start of C)=A ...@@ -169,6 +173,7 @@ foreach($paths as $tmppath) // We check to find (B+start of C)=A
} }
//else print "Not found yet for concatpath=".$concatpath."<br>\n"; //else print "Not found yet for concatpath=".$concatpath."<br>\n";
} }
//print "found=".$found." dolibarr_main_url_root=".$dolibarr_main_url_root."\n";
if (! $found) $tmp=$dolibarr_main_url_root; // If autodetect fails (Ie: when using apache alias that point outside default DOCUMENT_ROOT). if (! $found) $tmp=$dolibarr_main_url_root; // If autodetect fails (Ie: when using apache alias that point outside default DOCUMENT_ROOT).
else $tmp='http'.(((empty($_SERVER["HTTPS"]) || $_SERVER["HTTPS"] != 'on') && (empty($_SERVER["SERVER_PORT"])||$_SERVER["SERVER_PORT"]!=443))?'':'s').'://'.$_SERVER["SERVER_NAME"].((empty($_SERVER["SERVER_PORT"])||$_SERVER["SERVER_PORT"]==80||$_SERVER["SERVER_PORT"]==443)?'':':'.$_SERVER["SERVER_PORT"]).($tmp3?(preg_match('/^\//',$tmp3)?'':'/').$tmp3:''); else $tmp='http'.(((empty($_SERVER["HTTPS"]) || $_SERVER["HTTPS"] != 'on') && (empty($_SERVER["SERVER_PORT"])||$_SERVER["SERVER_PORT"]!=443))?'':'s').'://'.$_SERVER["SERVER_NAME"].((empty($_SERVER["SERVER_PORT"])||$_SERVER["SERVER_PORT"]==80||$_SERVER["SERVER_PORT"]==443)?'':':'.$_SERVER["SERVER_PORT"]).($tmp3?(preg_match('/^\//',$tmp3)?'':'/').$tmp3:'');
//print "tmp1=".$tmp1." tmp2=".$tmp2." tmp3=".$tmp3." tmp=".$tmp."\n"; //print "tmp1=".$tmp1." tmp2=".$tmp2." tmp3=".$tmp3." tmp=".$tmp."\n";
......
...@@ -30,6 +30,7 @@ global $conf,$user,$langs,$db; ...@@ -30,6 +30,7 @@ global $conf,$user,$langs,$db;
//define('TEST_DB_FORCE_TYPE','mysql'); // This is to force using mysql driver //define('TEST_DB_FORCE_TYPE','mysql'); // This is to force using mysql driver
//require_once 'PHPUnit/Autoload.php'; //require_once 'PHPUnit/Autoload.php';
require_once dirname(__FILE__).'/../../htdocs/master.inc.php'; require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
print 'DOL_MAIN_URL_ROOT='.DOL_MAIN_URL_ROOT."\n"; // constant will be used by other tests
if ($langs->defaultlang != 'en_US') if ($langs->defaultlang != 'en_US')
{ {
......
...@@ -40,7 +40,6 @@ if (empty($user->id)) ...@@ -40,7 +40,6 @@ if (empty($user->id))
$user->getrights(); $user->getrights();
} }
$conf->global->MAIN_DISABLE_ALL_MAILS=1; $conf->global->MAIN_DISABLE_ALL_MAILS=1;
print 'DOL_MAIN_URL_ROOT='.DOL_MAIN_URL_ROOT;
/** /**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment