From 4ba3a6cf702762a894f272cfb99a78089e2a5305 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Tue, 28 Jan 2020 16:39:55 +0000 Subject: [PATCH] Manage PHPUnit as a composer dependency --- .travis.yml | 3 ++- composer.json | 3 ++- tests/lint.sh | 31 ------------------------------- tests/run-tests.sh | 22 ---------------------- 4 files changed, 4 insertions(+), 55 deletions(-) delete mode 100755 tests/lint.sh delete mode 100755 tests/run-tests.sh diff --git a/.travis.yml b/.travis.yml index 80b940d..d152b79 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,10 +7,11 @@ php: before_script: - composer install --prefer-dist + - echo 'xdebug.max_nesting_level=3000' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini script: - ./vendor/bin/phpstan analyze --no-progress - - ./tests/run-tests.sh + - ./vendor/bin/phpunit --bootstrap vendor/autoload.php tests/phpunit cache: directories: diff --git a/composer.json b/composer.json index 68c59a2..93c82a2 100644 --- a/composer.json +++ b/composer.json @@ -9,7 +9,8 @@ "pocketmine/binaryutils": "^0.1.9" }, "require-dev": { - "phpstan/phpstan": "^0.12.8" + "phpstan/phpstan": "^0.12.8", + "irstea/phpunit-shim": "^7.5" }, "license": "LGPL-3.0", "autoload": { diff --git a/tests/lint.sh b/tests/lint.sh deleted file mode 100755 index 085c774..0000000 --- a/tests/lint.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash - -PHP_BINARY="php" -DIR="" - -while getopts "p:d:" OPTION 2> /dev/null; do - case ${OPTION} in - p) - PHP_BINARY="$OPTARG" - ;; - d) - DIR="$OPTARG" - ;; - esac -done - -if [ "$DIR" == "" ]; then - echo No directory specified - exit 1 -fi - -echo Running PHP lint scans on \"$DIR\"... - -OUTPUT=`find "$DIR" -name "*.php" -print0 | xargs -0 -n1 -P4 "$PHP_BINARY" -l` - -if [ $? -ne 0 ]; then - echo $OUTPUT | grep -v "No syntax errors" - exit 1 -fi - -echo Lint scan completed successfully. diff --git a/tests/run-tests.sh b/tests/run-tests.sh deleted file mode 100755 index c3f9957..0000000 --- a/tests/run-tests.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - -PHP_BINARY="php" - -while getopts "p:" OPTION 2> /dev/null; do - case ${OPTION} in - p) - PHP_BINARY="$OPTARG" - ;; - esac -done - -./tests/lint.sh -p "$PHP_BINARY" -d ./src -if [ $? -ne 0 ]; then - echo Lint scan failed! - exit 1 -fi - -curl https://phar.phpunit.de/phpunit-7.phar --silent --location -o phpunit.phar - -"$PHP_BINARY" -dxdebug.max_nesting_level=3000 phpunit.phar --bootstrap vendor/autoload.php tests/phpunit -