2014-03-03 02:10:01 +01:00
|
|
|
#!/bin/sh
|
|
|
|
set -e
|
|
|
|
set -x
|
|
|
|
|
2014-03-03 01:43:58 +01:00
|
|
|
export PHPSECLIB_SSH_HOSTNAME='localhost'
|
|
|
|
export PHPSECLIB_SSH_USERNAME='phpseclib'
|
|
|
|
export PHPSECLIB_SSH_PASSWORD='EePoov8po1aethu2kied1ne0'
|
2014-04-02 16:23:22 +02:00
|
|
|
export PHPSECLIB_SSH_HOME='/home/phpseclib'
|
2014-03-03 01:43:58 +01:00
|
|
|
|
2014-04-12 04:09:18 +02:00
|
|
|
if [ "$TRAVIS_PHP_VERSION" = '5.2' ]
|
|
|
|
then
|
|
|
|
PHPUNIT="phpunit"
|
|
|
|
else
|
|
|
|
PHPUNIT="$(dirname "$0")/../vendor/bin/phpunit"
|
|
|
|
fi
|
|
|
|
|
2014-12-12 23:04:41 +01:00
|
|
|
PHPUNIT_ARGS='--verbose'
|
2014-04-12 07:13:44 +02:00
|
|
|
if [ `php -r "echo (int) version_compare(PHP_VERSION, '5.4', '<');"` = "1" ]
|
2014-04-10 20:00:48 +02:00
|
|
|
then
|
2014-12-12 23:04:41 +01:00
|
|
|
PHPUNIT_ARGS="$PHPUNIT_ARGS -d zend.enable_gc=0"
|
2014-04-10 20:00:48 +02:00
|
|
|
fi
|
|
|
|
|
2020-12-12 22:11:04 +01:00
|
|
|
if [ `php -r "echo (int) version_compare(PHP_VERSION, '7.3', '>=');"` = "1" ]
|
|
|
|
then
|
|
|
|
find tests -type f -name "*.php" -print0 | xargs -0 sed -i 's/n setUpBeforeClass()/n setUpBeforeClass(): void/g'
|
|
|
|
find tests -type f -name "*.php" -print0 | xargs -0 sed -i 's/n setUp()/n setUp(): void/g'
|
|
|
|
find tests -type f -name "*.php" -print0 | xargs -0 sed -i 's/n tearDown()/n tearDown(): void/g'
|
|
|
|
find tests -type f -name "*.php" -print0 | xargs -0 sed -i 's/\(n assertIsArray([^)]*)\)/\1: void/g'
|
|
|
|
find tests -type f -name "*.php" -print0 | xargs -0 sed -i 's/\(n assertIsString([^)]*)\)/\1: void/g'
|
2020-12-13 02:34:38 +01:00
|
|
|
find tests -type f -name "*.php" -print0 | xargs -0 sed -i 's/\(n assertIsResource([^)]*)\)/\1: void/g'
|
|
|
|
find tests -type f -name "*.php" -print0 | xargs -0 sed -i 's/\(n assertIsObject([^)]*)\)/\1: void/g'
|
2020-12-12 22:11:04 +01:00
|
|
|
find tests -type f -name "*.php" -print0 | xargs -0 sed -i 's/\(n assertStringContainsString([^)]*)\)/\1: void/g'
|
|
|
|
find tests -type f -name "*.php" -print0 | xargs -0 sed -i 's/\(n assertStringNotContainsString([^)]*)\)/\1: void/g'
|
2020-12-13 05:47:25 +01:00
|
|
|
find tests -type f -name "*.php" -print0 | xargs -0 sed -i 's/^class Unit_Crypt_\(AES\|DSA\|EC\|RSA\)_/class /g'
|
2020-12-13 03:39:56 +01:00
|
|
|
find tests -type f -name "*.php" -print0 | xargs -0 sed -i 's/^class Unit_File_\(X509\)_/class /g'
|
|
|
|
find tests -type f -name "*.php" -print0 | xargs -0 sed -i 's/^class Unit_Math_\(BigInteger\)_/class /g'
|
|
|
|
find tests -type f -name "*.php" -print0 | xargs -0 sed -i 's/^class Unit_\(Crypt\|File\|Math\|Net\)_/class /g'
|
|
|
|
find tests -type f -name "*.php" -print0 | xargs -0 sed -i 's/^class Functional_Net_/class /g'
|
2020-12-12 22:11:04 +01:00
|
|
|
fi
|
|
|
|
|
2016-09-24 18:57:59 +02:00
|
|
|
if [ "$TRAVIS_PHP_VERSION" = 'hhvm' -o `php -r "echo (int) version_compare(PHP_VERSION, '7.0', '>=');"` = "1" ]
|
2014-12-12 23:04:41 +01:00
|
|
|
then
|
|
|
|
find tests -type f -name "*Test.php" | \
|
|
|
|
parallel --gnu --keep-order \
|
|
|
|
"echo '== {} =='; \"$PHPUNIT\" $PHPUNIT_ARGS {};"
|
|
|
|
else
|
|
|
|
"$PHPUNIT" \
|
|
|
|
$PHPUNIT_ARGS \
|
|
|
|
--coverage-text \
|
|
|
|
--coverage-clover code_coverage/clover.xml \
|
|
|
|
--coverage-html code_coverage/
|
|
|
|
fi
|