This commit is contained in:
NASDAMI Quatadah 2022-06-15 15:44:40 +02:00
parent e07a94a051
commit a11732bb0d
2 changed files with 273 additions and 278 deletions

View File

@ -14,13 +14,13 @@ git:
# Start on every boot # Start on every boot
services: services:
- memcached - memcached
- mysql - mysql
- postgresql - postgresql
addons: addons:
# Force postgresql to 9.4 (the oldest availablable on xenial) # Force postgresql to 9.4 (the oldest availablable on xenial)
postgresql: '9.4' postgresql: "9.4"
apt: apt:
sources: sources:
# To use the last version of pgloader, we add repo of postgresql with a name available in http://apt.postgresql.org/pub/repos/apt/ # To use the last version of pgloader, we add repo of postgresql with a name available in http://apt.postgresql.org/pub/repos/apt/
@ -46,11 +46,11 @@ jobs:
include: include:
- stage: PHP 5.6-7.4 - stage: PHP 5.6-7.4
if: type = push if: type = push
php: '5.6' php: "5.6"
env: DB=postgresql env: DB=postgresql
- stage: PHP 5.6-7.4 - stage: PHP 5.6-7.4
if: type = pull_request OR type = push if: type = pull_request OR type = push
php: '7.4.22' php: "7.4.22"
env: DB=mysql env: DB=mysql
- stage: PHP Dev - stage: PHP Dev
if: type = push AND branch = develop if: type = push AND branch = develop
@ -73,7 +73,7 @@ notifications:
use_notice: true use_notice: true
before_install: before_install:
- | - |
echo "Disabling Xdebug for composer" echo "Disabling Xdebug for composer"
export PHP_VERSION_NAME=$(phpenv version-name) export PHP_VERSION_NAME=$(phpenv version-name)
cp ~/.phpenv/versions/$PHP_VERSION_NAME/etc/conf.d/xdebug.ini /tmp/xdebug.ini cp ~/.phpenv/versions/$PHP_VERSION_NAME/etc/conf.d/xdebug.ini /tmp/xdebug.ini
@ -81,7 +81,7 @@ before_install:
echo echo
install: install:
- | - |
echo "Updating Composer" echo "Updating Composer"
rm $TRAVIS_BUILD_DIR/composer.json rm $TRAVIS_BUILD_DIR/composer.json
rm $TRAVIS_BUILD_DIR/composer.lock rm $TRAVIS_BUILD_DIR/composer.lock
@ -92,7 +92,7 @@ install:
composer -n config -g vendor-dir htdocs/includes composer -n config -g vendor-dir htdocs/includes
echo echo
- | - |
echo "Installing Composer dependencies - PHP Unit, Parallel Lint, PHP CodeSniffer - for $TRAVIS_PHP_VERSION" echo "Installing Composer dependencies - PHP Unit, Parallel Lint, PHP CodeSniffer - for $TRAVIS_PHP_VERSION"
if [ "$TRAVIS_PHP_VERSION" = '5.6' ]; then if [ "$TRAVIS_PHP_VERSION" = '5.6' ]; then
composer -n require phpunit/phpunit ^5 \ composer -n require phpunit/phpunit ^5 \
@ -121,7 +121,7 @@ install:
fi fi
echo echo
- | - |
echo "Adding path of binaries tools installed by composer to the PATH" echo "Adding path of binaries tools installed by composer to the PATH"
export PATH="$TRAVIS_BUILD_DIR/htdocs/includes/bin:$PATH" export PATH="$TRAVIS_BUILD_DIR/htdocs/includes/bin:$PATH"
echo $PATH echo $PATH
@ -129,8 +129,6 @@ install:
ls $TRAVIS_BUILD_DIR/htdocs/includes/bin ls $TRAVIS_BUILD_DIR/htdocs/includes/bin
echo echo
before_script: before_script:
- | - |
echo Start travis echo Start travis
@ -236,7 +234,6 @@ before_script:
echo "***** First line of dolibarr.log" > $TRAVIS_BUILD_DIR/documents/dolibarr.log echo "***** First line of dolibarr.log" > $TRAVIS_BUILD_DIR/documents/dolibarr.log
echo echo
- echo "Setting up Apache + FPM" - echo "Setting up Apache + FPM"
# enable php-fpm # enable php-fpm
- sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf - sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf
@ -256,10 +253,8 @@ before_script:
- sudo cat /etc/apache2/sites-available/000-default.conf - sudo cat /etc/apache2/sites-available/000-default.conf
- sudo service apache2 restart - sudo service apache2 restart
script: script:
- | - |
echo "Checking webserver availability by a wget -O - http://127.0.0.1" echo "Checking webserver availability by a wget -O - http://127.0.0.1"
# Ensure we stop on error with set -e # Ensure we stop on error with set -e
set +e set +e
@ -270,7 +265,7 @@ script:
set +e set +e
echo echo
- | - |
echo "Checking PHP syntax errors (only 1 version to not overload travis and avoid duplicate tests)" echo "Checking PHP syntax errors (only 1 version to not overload travis and avoid duplicate tests)"
# Ensure we catch errors # Ensure we catch errors
set -e set -e
@ -286,7 +281,7 @@ script:
set +e set +e
echo echo
- | - |
echo "Checking coding style (only for Pull Requests builds and 1 version to not overload travis and avoid duplicate tests)" echo "Checking coding style (only for Pull Requests builds and 1 version to not overload travis and avoid duplicate tests)"
# Ensure we catch errors # Ensure we catch errors
set -e set -e
@ -297,7 +292,7 @@ script:
set +e set +e
echo echo
- | - |
export INSTALL_FORCED_FILE=htdocs/install/install.forced.php export INSTALL_FORCED_FILE=htdocs/install/install.forced.php
echo "Setting up Dolibarr $INSTALL_FORCED_FILE to test installation" echo "Setting up Dolibarr $INSTALL_FORCED_FILE to test installation"
# Ensure we catch errors # Ensure we catch errors
@ -322,23 +317,23 @@ script:
echo '$'force_install_main_data_root=\'$TRAVIS_BUILD_DIR/htdocs\'';' >> $INSTALL_FORCED_FILE echo '$'force_install_main_data_root=\'$TRAVIS_BUILD_DIR/htdocs\'';' >> $INSTALL_FORCED_FILE
#cat $INSTALL_FORCED_FILE #cat $INSTALL_FORCED_FILE
#- | #- |
# echo "Installing Dolibarr" # echo "Installing Dolibarr"
# cd htdocs/install # cd htdocs/install
# php step1.php $TRAVIS_BUILD_DIR/htdocs > $TRAVIS_BUILD_DIR/install.log # php step1.php $TRAVIS_BUILD_DIR/htdocs > $TRAVIS_BUILD_DIR/install.log
# php step2.php set >> $TRAVIS_BUILD_DIR/install.log # php step2.php set >> $TRAVIS_BUILD_DIR/install.log
# if [ "$?" -ne "0" ]; then # if [ "$?" -ne "0" ]; then
# echo "SORRY, AN ERROR OCCURED DURING INSTALLATION PROCESS" # echo "SORRY, AN ERROR OCCURED DURING INSTALLATION PROCESS"
# cat $TRAVIS_BUILD_DIR/install.log # cat $TRAVIS_BUILD_DIR/install.log
# exit 1 # exit 1
# fi # fi
# cd ../.. # cd ../..
# rm $INSTALL_FORCED_FILE # rm $INSTALL_FORCED_FILE
# #cat $TRAVIS_BUILD_DIR/install.log # #cat $TRAVIS_BUILD_DIR/install.log
# set +e # set +e
# echo # echo
- | - |
echo "Setting up database to test migrations" echo "Setting up database to test migrations"
if [ "$DB" = 'mysql' ] || [ "$DB" = 'mariadb' ] || [ "$DB" = 'postgresql' ]; then if [ "$DB" = 'mysql' ] || [ "$DB" = 'mariadb' ] || [ "$DB" = 'postgresql' ]; then
echo "MySQL" echo "MySQL"
@ -361,7 +356,7 @@ script:
fi fi
echo echo
- | - |
echo "Upgrading Dolibarr" echo "Upgrading Dolibarr"
# Ensure we catch errors. Set this to +e if you want to go to the end to see log files. # Ensure we catch errors. Set this to +e if you want to go to the end to see log files.
set +e set +e
@ -416,7 +411,7 @@ script:
php step5.php 14.0.0 15.0.0 > $TRAVIS_BUILD_DIR/upgrade14001500-3.log php step5.php 14.0.0 15.0.0 > $TRAVIS_BUILD_DIR/upgrade14001500-3.log
ls -alrt $TRAVIS_BUILD_DIR/ ls -alrt $TRAVIS_BUILD_DIR/
- | - |
echo "Enabling new modules" echo "Enabling new modules"
# Enable modules not enabled into original dump # Enable modules not enabled into original dump
set -e set -e
@ -431,28 +426,28 @@ script:
#cat /tmp/dolibarr_install.log #cat /tmp/dolibarr_install.log
cat $TRAVIS_BUILD_DIR/enablemodule.log cat $TRAVIS_BUILD_DIR/enablemodule.log
- | - |
echo "Unit testing" echo "Unit testing"
# Ensure we catch errors. Set this to +e if you want to go to the end to see dolibarr.log file. # Ensure we catch errors. Set this to +e if you want to go to the end to see dolibarr.log file.
set +e set -e
phpunit -d memory_limit=-1 -c test/phpunit/phpunittest.xml test/phpunit/AllTests.php phpunit -d memory_limit=-1 -c test/phpunit/phpunittest.xml test/phpunit/AllTests.php
phpunitresult=$? phpunitresult=$?
echo "Phpunit return code = $phpunitresult" echo "Phpunit return code = $phpunitresult"
set +e set +e
after_script: after_script:
- | - |
echo "After script - Output last lines of dolibarr.log" echo "After script - Output last lines of dolibarr.log"
ls $TRAVIS_BUILD_DIR/documents ls $TRAVIS_BUILD_DIR/documents
#cat $TRAVIS_BUILD_DIR/documents/dolibarr.log #cat $TRAVIS_BUILD_DIR/documents/dolibarr.log
sudo tail -n 50 $TRAVIS_BUILD_DIR/documents/dolibarr.log sudo tail -n 50 $TRAVIS_BUILD_DIR/documents/dolibarr.log
after_success: after_success:
- | - |
echo Success echo Success
after_failure: after_failure:
- | - |
echo Failure detected, so we show samples of log to help diagnose echo Failure detected, so we show samples of log to help diagnose
# This part of code is executed only if previous command that fails are enclosed with set +e # This part of code is executed only if previous command that fails are enclosed with set +e
# Upgrade log files # Upgrade log files

View File

@ -281,7 +281,7 @@ class UserTest extends PHPUnit\Framework\TestCase
print __METHOD__." id=". $localobject->id ."\n"; print __METHOD__." id=". $localobject->id ."\n";
//$this->assertNotEquals($user->date_creation, ''); //$this->assertNotEquals($user->date_creation, '');
$user->addrights(0, 'supplier_proposal'); $localobject->addrights(0, 'supplier_proposal');
$this->assertEquals($localobject->hasRight('member', ''), 0); $this->assertEquals($localobject->hasRight('member', ''), 0);
$this->assertEquals($localobject->hasRight('member', 'member'), 0);$this->assertEquals($localobject->hasRight('product', 'member', 'read'), 0); $this->assertEquals($localobject->hasRight('member', 'member'), 0);$this->assertEquals($localobject->hasRight('product', 'member', 'read'), 0);
$this->assertEquals($localobject->hasRight('member', 'member'), 0);$this->assertEquals($localobject->hasRight('produit', 'member', 'read'), 0); $this->assertEquals($localobject->hasRight('member', 'member'), 0);$this->assertEquals($localobject->hasRight('produit', 'member', 'read'), 0);