From e5d0dfb03ada709a80040b0f1fa9286f266ccad0 Mon Sep 17 00:00:00 2001 From: Kees Meijer Date: Wed, 30 Jan 2019 17:05:46 +0100 Subject: [PATCH 1/3] Fix Undefined property errors Fixes errors for nikic/php-parser v1.2.0+ by checking the property. See issue #206 --- lib/class-file-reflector.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/class-file-reflector.php b/lib/class-file-reflector.php index 5b01e8d..62f401d 100644 --- a/lib/class-file-reflector.php +++ b/lib/class-file-reflector.php @@ -171,7 +171,10 @@ public function leaveNode( \PHPParser_Node $node ) { break; case 'Stmt_Function': - end( $this->functions )->uses = array_pop( $this->location )->uses; + $function = array_pop( $this->location ); + if ( isset( $function->uses ) && ! empty( $function->uses ) ) { + end( $this->functions )->uses = $function->uses; + } break; case 'Stmt_ClassMethod': From 71a55d8247c6c0ad85976d2fe5a04c7825421b3a Mon Sep 17 00:00:00 2001 From: Kees Meijer Date: Wed, 30 Jan 2019 17:10:36 +0100 Subject: [PATCH 2/3] Install compatible PHPUnit version Installs the latest WP version Installs the compatible PHPUnit version depending on PHP version. --- .travis.yml | 52 ++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 40 insertions(+), 12 deletions(-) diff --git a/.travis.yml b/.travis.yml index 18bbdb5..8067598 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,23 +9,51 @@ matrix: - php: 5.6 - php: 5.5 - php: 5.4 - - php: hhvm before_install: - # Setup WP_TESTS_DIR (needed to bootstrap WP PHPUnit tests). - - export WP_TESTS_DIR=/tmp/wordpress/tests/phpunit/ - # Clone the WordPress develop repo. - - git clone --depth=1 --branch="4.3" git://develop.git.wordpress.org/ /tmp/wordpress/ - # Setup DB. - - mysql -e "CREATE DATABASE wordpress_test;" -uroot - # Setup wp-config. - - cp /tmp/wordpress/wp-tests-config-sample.php /tmp/wordpress/wp-tests-config.php - - sed -i "s/youremptytestdbnamehere/wordpress_test/" /tmp/wordpress/wp-tests-config.php - - sed -i "s/yourusernamehere/root/" /tmp/wordpress/wp-tests-config.php - - sed -i "s/yourpasswordhere//" /tmp/wordpress/wp-tests-config.php + # Setup WP_TESTS_DIR (needed to bootstrap WP PHPUnit tests). + - export WP_TESTS_DIR=/tmp/wordpress/tests/phpunit/ + # http serves a single offer, whereas https serves multiple. we only want one + - curl -s http://api.wordpress.org/core/version-check/1.7/ > /tmp/wp-latest.json + - WP_VERSION=$(grep -o '"version":"[^"]*' /tmp/wp-latest.json | sed 's/"version":"//') + - printf "Cloning WordPress %s\n" "$WP_VERSION" + # Clone the WordPress develop repo. + - git clone --depth=1 --branch="$WP_VERSION" git://develop.git.wordpress.org/ /tmp/wordpress/ + # Setup DB. + - mysql -e "CREATE DATABASE wordpress_test;" -uroot + # Setup wp-config. + - cp /tmp/wordpress/wp-tests-config-sample.php /tmp/wordpress/wp-tests-config.php + - sed -i "s/youremptytestdbnamehere/wordpress_test/" /tmp/wordpress/wp-tests-config.php + - sed -i "s/yourusernamehere/root/" /tmp/wordpress/wp-tests-config.php + - sed -i "s/yourpasswordhere//" /tmp/wordpress/wp-tests-config.php install: composer install --no-dev +before_script: + - | + # Export Composer's global bin dir to PATH, but not on PHP 5.2: + if [[ ${TRAVIS_PHP_VERSION:0:3} != "5.2" ]]; then + composer config --list --global + export PATH=`composer config --list --global | grep '\[home\]' | { read a; echo "${a#* }/vendor/bin:$PATH"; }` + fi + - | + # Install the specified version of PHPUnit depending on the PHP version: + case "$TRAVIS_PHP_VERSION" in + 7.3|7.2|7.1|7.0|nightly) + echo "Using PHPUnit 6.x" + travis_retry composer global require "phpunit/phpunit:^6" + # See trac ticket #43218 for when we can use PHPUnit 7 + ;; + 5.6|5.5|5.4|5.3) + echo "Using PHPUnit 4.x" + travis_retry composer global require "phpunit/phpunit:^4" + ;; + *) + echo "No PHPUnit version handling for PHP version $TRAVIS_PHP_VERSION" + exit 1 + ;; + esac + script: - phpunit From bbb543f15351e54bfb442f53fe138cee9af43914 Mon Sep 17 00:00:00 2001 From: Kees Meijer Date: Thu, 31 Jan 2019 10:26:50 +0100 Subject: [PATCH 3/3] Add PHP 7.2 --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 8067598..2ecea4a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,7 @@ sudo: false matrix: include: + - php: 7.2 - php: 7.1 - php: 7.0 - php: 5.6