Skip to content

Commit

Permalink
devel: travis ci test only last commited files, move testing process …
Browse files Browse the repository at this point in the history
…to two devel scripts (partial/whole) testing, unification of testing process
  • Loading branch information
interduo committed Jan 11, 2024
1 parent bc0cb75 commit abf7c7b
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 5 deletions.
7 changes: 2 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,14 @@ services:

install:
- composer install
- npm install -g jshint

before_script:
- psql -c 'create database lms;' -U postgres
- psql -U postgres -f doc/lms.pgsql
- mysql -e 'CREATE DATABASE lms;'
- mysql lms < doc/lms.mysql
- if find . -name "*.php" ! -path "./vendor/*" -print0 | xargs -0 -n 1 -P 8 php -l | grep -v "No syntax errors detected"; then exit 1; fi
- if find templates -type f -iname '*.html' | xargs devel/smartylint.php |grep -i "syntax error"; then exit 1; fi
- ./vendor/bin/phpcs --standard=$PHPCS_STANDARD .
- npm install -g jshint
- jshint .
- devel/test-incremental.sh
#- ./vendor/bin/phpunit

script: true
Expand Down
14 changes: 14 additions & 0 deletions devel/test-full.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash
#Script for testing

PHPCS_STANDARD="phpcs3.xml"

#Test Smarty templates
if find templates -type f -iname '*.html' | xargs devel/smartylint.php |grep -i "syntax error"; then exit 1; fi

#Test PHP files
if find . -name "*.php" ! -path "./vendor/*" -print0 | xargs -0 -n 1 -P 8 php -l | grep -v "No syntax errors detected"; then exit 1; fi
./vendor/bin/phpcs --standard=$PHPCS_STANDARD .

#Test JS files
jshint .
29 changes: 29 additions & 0 deletions devel/test-incremental.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash
PHPCS_STANDARD="phpcs3.xml"

#Test Smarty templates
for i in `git diff --name-only HEAD HEAD~1 '*.html'`
do
if devel/smartylint.php $i | grep -i "syntax error"
then
exit 1
fi
done

#Test PHP files
for i in `git diff --name-only HEAD HEAD~1 '*.php'`
do
if (php -l $i | grep -v 'No syntax errors detected') || (vendor/bin/phpcs --standard=$PHPCS_STANDARD $i)
then
exit 1
fi
done

#Test JS files
for i in `git diff --name-only HEAD HEAD~1 '*.js'`
do
if (jshint $i)
then
exit 1
fi
done

0 comments on commit abf7c7b

Please sign in to comment.