Fix: checkstyle

Try phpcs into travis
This commit is contained in:
Laurent Destailleur 2013-09-10 02:09:55 +02:00
parent ad851a6432
commit c147fc6016
2 changed files with 20 additions and 3 deletions

View File

@ -22,6 +22,9 @@ before_script:
- echo Home dir is `echo ~` - echo Home dir is `echo ~`
- echo Update composer - echo Update composer
# - ~/.phpenv/versions/$(phpenv version-name)/bin/composer.phar self-update # - ~/.phpenv/versions/$(phpenv version-name)/bin/composer.phar self-update
- echo Install phpcs
- pyrus install pear/PHP_CodeSniffer
- phpenv rehash
- echo Create dir $(pwd)/htdocs/documents - echo Create dir $(pwd)/htdocs/documents
- sudo mkdir -p $(pwd)/htdocs/documents/admin/temp; - sudo mkdir -p $(pwd)/htdocs/documents/admin/temp;
- sudo touch $(pwd)/htdocs/documents/dolibarr.log; - sudo touch $(pwd)/htdocs/documents/dolibarr.log;
@ -72,7 +75,9 @@ before_script:
# use the $DB env variable to determine the phpunit.xml to use # use the $DB env variable to determine the phpunit.xml to use
#script: phpunit -d memory_limit=-1 --configuration test/phpunit/phpunittest.xml --coverage-text test/phpunit/AllTests.php #script: phpunit -d memory_limit=-1 --configuration test/phpunit/phpunittest.xml --coverage-text test/phpunit/AllTests.php
#script: phpunit -d memory_limit=-1 --configuration test/phpunit/phpunittest.xml --coverage-text test/phpunit/BuildDocTest.php #script: phpunit -d memory_limit=-1 --configuration test/phpunit/phpunittest.xml --coverage-text test/phpunit/BuildDocTest.php
script: phpunit -d memory_limit=-1 --configuration test/phpunit/phpunittest.xml test/phpunit/AllTests.php script:
- phpcs --report=xml --standard=dev/codesniffer --tab-width=4 scripts
- phpunit -d memory_limit=-1 --configuration test/phpunit/phpunittest.xml test/phpunit/AllTests.php
#script: phpunit -d memory_limit=-1 --configuration test/phpunit/phpunittest.xml test/phpunit/WebservicesOtherTest.php #script: phpunit -d memory_limit=-1 --configuration test/phpunit/phpunittest.xml test/phpunit/WebservicesOtherTest.php
after_script: after_script:

View File

@ -131,8 +131,20 @@ class HookManager
// Define type of hook ('output', 'returnvalue' or 'addreplace'). 'addreplace' should be type for all hooks. 'output' and 'returnvalue' are deprecated. // Define type of hook ('output', 'returnvalue' or 'addreplace'). 'addreplace' should be type for all hooks. 'output' and 'returnvalue' are deprecated.
$hooktype='output'; $hooktype='output';
if (preg_match('/^pdf_/',$method)) $hooktype='returnvalue'; // pdf_xxx except pdf_writelinedesc are returnvalue hooks. When there is 2 hooks of this type, only last one win. if (preg_match('/^pdf_/',$method)) $hooktype='returnvalue'; // pdf_xxx except pdf_writelinedesc are returnvalue hooks. When there is 2 hooks of this type, only last one win.
if (in_array($method,array('addStatisticLine','doActions','formObjectOptions','formattachOptions','formBuilddocLineOptions','moveUploadedFile','pdf_writelinedesc','paymentsupplierinvoices', if (in_array(
'printSearchForm'))) $hooktype='addreplace'; $method,
array(
'addStatisticLine',
'doActions',
'formObjectOptions',
'formattachOptions',
'formBuilddocLineOptions',
'moveUploadedFile',
'pdf_writelinedesc',
'paymentsupplierinvoices',
'printSearchForm'
)
)) $hooktype='addreplace';
// Loop on each hook to qualify modules that declared context // Loop on each hook to qualify modules that declared context
$modulealreadyexecuted=array(); $modulealreadyexecuted=array();