From 92efe0db29a15ce59fc042d38a3d4d3ebb03acab Mon Sep 17 00:00:00 2001 From: Julian Weiland Date: Mon, 14 Jan 2019 14:17:37 +0100 Subject: [PATCH 1/8] travis ci added --- .phpcs.xml.dist | 49 +++++++++++++ .travis.yml | 65 +++++++++++++++++ bin/install-wp-tests.sh | 155 ++++++++++++++++++++++++++++++++++++++++ phpunit.xml.dist | 16 +++++ tests/bootstrap.php | 48 +++++++++++++ tests/test-sample.php | 20 ++++++ 6 files changed, 353 insertions(+) create mode 100644 .phpcs.xml.dist create mode 100644 .travis.yml create mode 100755 bin/install-wp-tests.sh create mode 100644 phpunit.xml.dist create mode 100644 tests/bootstrap.php create mode 100644 tests/test-sample.php diff --git a/.phpcs.xml.dist b/.phpcs.xml.dist new file mode 100644 index 000000000..067d574fe --- /dev/null +++ b/.phpcs.xml.dist @@ -0,0 +1,49 @@ + + + Generally-applicable sniffs for WordPress plugins. + + + . + /vendor/ + /node_modules/ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000..ec9429e11 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,65 @@ +sudo: false +dist: trusty + +language: php + +notifications: + email: + on_success: never + on_failure: change + +branches: + only: + - master + +cache: + directories: + - $HOME/.composer/cache + +matrix: + include: + - php: 7.2 + env: WP_VERSION=latest + - php: 7.1 + env: WP_VERSION=latest + - php: 7.0 + env: WP_VERSION=latest + - php: 5.6 + env: WP_VERSION=latest + - php: 5.6 + env: WP_VERSION=trunk + - php: 5.6 + env: WP_TRAVISCI=phpcs + - php: 5.3 + env: WP_VERSION=latest + dist: precise + +before_script: + - export PATH="$HOME/.composer/vendor/bin:$PATH" + - | + if [ -f ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini ]; then + phpenv config-rm xdebug.ini + else + echo "xdebug.ini does not exist" + fi + - | + if [[ ! -z "$WP_VERSION" ]] ; then + bash bin/install-wp-tests.sh wordpress_test root '' localhost $WP_VERSION + composer global require "phpunit/phpunit=4.8.*|5.7.*" + fi + - | + if [[ "$WP_TRAVISCI" == "phpcs" ]] ; then + composer global require wp-coding-standards/wpcs + phpcs --config-set installed_paths $HOME/.composer/vendor/wp-coding-standards/wpcs + fi + +script: + - | + if [[ ! -z "$WP_VERSION" ]] ; then + phpunit + WP_MULTISITE=1 phpunit + fi + - | + if [[ "$WP_TRAVISCI" == "phpcs" ]] ; then + phpcs + fi diff --git a/bin/install-wp-tests.sh b/bin/install-wp-tests.sh new file mode 100755 index 000000000..5ceac4b84 --- /dev/null +++ b/bin/install-wp-tests.sh @@ -0,0 +1,155 @@ +#!/usr/bin/env bash + +if [ $# -lt 3 ]; then + echo "usage: $0 [db-host] [wp-version] [skip-database-creation]" + exit 1 +fi + +DB_NAME=$1 +DB_USER=$2 +DB_PASS=$3 +DB_HOST=${4-localhost} +WP_VERSION=${5-latest} +SKIP_DB_CREATE=${6-false} + +TMPDIR=${TMPDIR-/tmp} +TMPDIR=$(echo $TMPDIR | sed -e "s/\/$//") +WP_TESTS_DIR=${WP_TESTS_DIR-$TMPDIR/wordpress-tests-lib} +WP_CORE_DIR=${WP_CORE_DIR-$TMPDIR/wordpress/} + +download() { + if [ `which curl` ]; then + curl -s "$1" > "$2"; + elif [ `which wget` ]; then + wget -nv -O "$2" "$1" + fi +} + +if [[ $WP_VERSION =~ ^[0-9]+\.[0-9]+\-(beta|RC)[0-9]+$ ]]; then + WP_BRANCH=${WP_VERSION%\-*} + WP_TESTS_TAG="branches/$WP_BRANCH" + +elif [[ $WP_VERSION =~ ^[0-9]+\.[0-9]+$ ]]; then + WP_TESTS_TAG="branches/$WP_VERSION" +elif [[ $WP_VERSION =~ [0-9]+\.[0-9]+\.[0-9]+ ]]; then + if [[ $WP_VERSION =~ [0-9]+\.[0-9]+\.[0] ]]; then + # version x.x.0 means the first release of the major version, so strip off the .0 and download version x.x + WP_TESTS_TAG="tags/${WP_VERSION%??}" + else + WP_TESTS_TAG="tags/$WP_VERSION" + fi +elif [[ $WP_VERSION == 'nightly' || $WP_VERSION == 'trunk' ]]; then + WP_TESTS_TAG="trunk" +else + # http serves a single offer, whereas https serves multiple. we only want one + download http://api.wordpress.org/core/version-check/1.7/ /tmp/wp-latest.json + grep '[0-9]+\.[0-9]+(\.[0-9]+)?' /tmp/wp-latest.json + LATEST_VERSION=$(grep -o '"version":"[^"]*' /tmp/wp-latest.json | sed 's/"version":"//') + if [[ -z "$LATEST_VERSION" ]]; then + echo "Latest WordPress version could not be found" + exit 1 + fi + WP_TESTS_TAG="tags/$LATEST_VERSION" +fi +set -ex + +install_wp() { + + if [ -d $WP_CORE_DIR ]; then + return; + fi + + mkdir -p $WP_CORE_DIR + + if [[ $WP_VERSION == 'nightly' || $WP_VERSION == 'trunk' ]]; then + mkdir -p $TMPDIR/wordpress-nightly + download https://wordpress.org/nightly-builds/wordpress-latest.zip $TMPDIR/wordpress-nightly/wordpress-nightly.zip + unzip -q $TMPDIR/wordpress-nightly/wordpress-nightly.zip -d $TMPDIR/wordpress-nightly/ + mv $TMPDIR/wordpress-nightly/wordpress/* $WP_CORE_DIR + else + if [ $WP_VERSION == 'latest' ]; then + local ARCHIVE_NAME='latest' + elif [[ $WP_VERSION =~ [0-9]+\.[0-9]+ ]]; then + # https serves multiple offers, whereas http serves single. + download https://api.wordpress.org/core/version-check/1.7/ $TMPDIR/wp-latest.json + if [[ $WP_VERSION =~ [0-9]+\.[0-9]+\.[0] ]]; then + # version x.x.0 means the first release of the major version, so strip off the .0 and download version x.x + LATEST_VERSION=${WP_VERSION%??} + else + # otherwise, scan the releases and get the most up to date minor version of the major release + local VERSION_ESCAPED=`echo $WP_VERSION | sed 's/\./\\\\./g'` + LATEST_VERSION=$(grep -o '"version":"'$VERSION_ESCAPED'[^"]*' $TMPDIR/wp-latest.json | sed 's/"version":"//' | head -1) + fi + if [[ -z "$LATEST_VERSION" ]]; then + local ARCHIVE_NAME="wordpress-$WP_VERSION" + else + local ARCHIVE_NAME="wordpress-$LATEST_VERSION" + fi + else + local ARCHIVE_NAME="wordpress-$WP_VERSION" + fi + download https://wordpress.org/${ARCHIVE_NAME}.tar.gz $TMPDIR/wordpress.tar.gz + tar --strip-components=1 -zxmf $TMPDIR/wordpress.tar.gz -C $WP_CORE_DIR + fi + + download https://raw.github.com/markoheijnen/wp-mysqli/master/db.php $WP_CORE_DIR/wp-content/db.php +} + +install_test_suite() { + # portable in-place argument for both GNU sed and Mac OSX sed + if [[ $(uname -s) == 'Darwin' ]]; then + local ioption='-i.bak' + else + local ioption='-i' + fi + + # set up testing suite if it doesn't yet exist + if [ ! -d $WP_TESTS_DIR ]; then + # set up testing suite + mkdir -p $WP_TESTS_DIR + svn co --quiet https://develop.svn.wordpress.org/${WP_TESTS_TAG}/tests/phpunit/includes/ $WP_TESTS_DIR/includes + svn co --quiet https://develop.svn.wordpress.org/${WP_TESTS_TAG}/tests/phpunit/data/ $WP_TESTS_DIR/data + fi + + if [ ! -f wp-tests-config.php ]; then + download https://develop.svn.wordpress.org/${WP_TESTS_TAG}/wp-tests-config-sample.php "$WP_TESTS_DIR"/wp-tests-config.php + # remove all forward slashes in the end + WP_CORE_DIR=$(echo $WP_CORE_DIR | sed "s:/\+$::") + sed $ioption "s:dirname( __FILE__ ) . '/src/':'$WP_CORE_DIR/':" "$WP_TESTS_DIR"/wp-tests-config.php + sed $ioption "s/youremptytestdbnamehere/$DB_NAME/" "$WP_TESTS_DIR"/wp-tests-config.php + sed $ioption "s/yourusernamehere/$DB_USER/" "$WP_TESTS_DIR"/wp-tests-config.php + sed $ioption "s/yourpasswordhere/$DB_PASS/" "$WP_TESTS_DIR"/wp-tests-config.php + sed $ioption "s|localhost|${DB_HOST}|" "$WP_TESTS_DIR"/wp-tests-config.php + fi + +} + +install_db() { + + if [ ${SKIP_DB_CREATE} = "true" ]; then + return 0 + fi + + # parse DB_HOST for port or socket references + local PARTS=(${DB_HOST//\:/ }) + local DB_HOSTNAME=${PARTS[0]}; + local DB_SOCK_OR_PORT=${PARTS[1]}; + local EXTRA="" + + if ! [ -z $DB_HOSTNAME ] ; then + if [ $(echo $DB_SOCK_OR_PORT | grep -e '^[0-9]\{1,\}$') ]; then + EXTRA=" --host=$DB_HOSTNAME --port=$DB_SOCK_OR_PORT --protocol=tcp" + elif ! [ -z $DB_SOCK_OR_PORT ] ; then + EXTRA=" --socket=$DB_SOCK_OR_PORT" + elif ! [ -z $DB_HOSTNAME ] ; then + EXTRA=" --host=$DB_HOSTNAME --protocol=tcp" + fi + fi + + # create database + mysqladmin create $DB_NAME --user="$DB_USER" --password="$DB_PASS"$EXTRA +} + +install_wp +install_test_suite +install_db diff --git a/phpunit.xml.dist b/phpunit.xml.dist new file mode 100644 index 000000000..16a39027e --- /dev/null +++ b/phpunit.xml.dist @@ -0,0 +1,16 @@ + + + + + ./tests/ + ./tests/test-sample.php + + + diff --git a/tests/bootstrap.php b/tests/bootstrap.php new file mode 100644 index 000000000..778b1dea3 --- /dev/null +++ b/tests/bootstrap.php @@ -0,0 +1,48 @@ +assertTrue( true ); + } +} From 7d4ccb7e7fb24b6d79dfc099afc28833db4a14c5 Mon Sep 17 00:00:00 2001 From: Julian Weiland Date: Mon, 14 Jan 2019 14:34:34 +0100 Subject: [PATCH 2/8] php 5.3 removed --- .travis.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index ec9429e11..5957d4b5c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,9 +30,6 @@ matrix: env: WP_VERSION=trunk - php: 5.6 env: WP_TRAVISCI=phpcs - - php: 5.3 - env: WP_VERSION=latest - dist: precise before_script: - export PATH="$HOME/.composer/vendor/bin:$PATH" From c4f1f851dea5826c706f9de82dd1ca05274d2355 Mon Sep 17 00:00:00 2001 From: Julian Weiland Date: Mon, 14 Jan 2019 16:07:07 +0100 Subject: [PATCH 3/8] CI activated for travis-ci branch --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 5957d4b5c..986c11537 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,7 +10,7 @@ notifications: branches: only: - - master + - travis-ci cache: directories: From e2d409c3355fddeef35331d792da27306ce015de Mon Sep 17 00:00:00 2001 From: Julian Weiland Date: Mon, 14 Jan 2019 16:52:21 +0100 Subject: [PATCH 4/8] phpunit xml reference --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 986c11537..298b1f67f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -53,8 +53,8 @@ before_script: script: - | if [[ ! -z "$WP_VERSION" ]] ; then - phpunit - WP_MULTISITE=1 phpunit + phpunit ./phpunit.xml.dist + WP_MULTISITE=1 phpunit ./phpunit.xml.dist fi - | if [[ "$WP_TRAVISCI" == "phpcs" ]] ; then From aeb60aeedde53f9b759277168a7860f3130e6789 Mon Sep 17 00:00:00 2001 From: Julian Weiland Date: Tue, 15 Jan 2019 11:19:39 +0100 Subject: [PATCH 5/8] php compatibility tests --- .gitignore | 3 +- .phpcs.xml.dist | 49 -------- .travis.yml | 79 ++++-------- bin/install-wp-tests.sh | 155 ------------------------ composer.json | 5 + composer.lock | 232 +++++++++++++++++++++++++++++++++--- library/enqueue-scripts.php | 2 +- tests/bootstrap.php | 48 -------- tests/test-sample.php | 20 ---- 9 files changed, 250 insertions(+), 343 deletions(-) delete mode 100644 .phpcs.xml.dist delete mode 100755 bin/install-wp-tests.sh delete mode 100644 tests/bootstrap.php delete mode 100644 tests/test-sample.php diff --git a/.gitignore b/.gitignore index 541cf66dd..b1ee5ea76 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,5 @@ config.yml .idea/ *.swp packaged/ -wpcs/ \ No newline at end of file +wpcs/ +vendor/ diff --git a/.phpcs.xml.dist b/.phpcs.xml.dist deleted file mode 100644 index 067d574fe..000000000 --- a/.phpcs.xml.dist +++ /dev/null @@ -1,49 +0,0 @@ - - - Generally-applicable sniffs for WordPress plugins. - - - . - /vendor/ - /node_modules/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.travis.yml b/.travis.yml index 298b1f67f..291a84b51 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,62 +1,31 @@ -sudo: false -dist: trusty - language: php -notifications: - email: - on_success: never - on_failure: change - -branches: - only: - - travis-ci - -cache: - directories: - - $HOME/.composer/cache - matrix: include: - - php: 7.2 - env: WP_VERSION=latest - - php: 7.1 - env: WP_VERSION=latest - - php: 7.0 - env: WP_VERSION=latest - - php: 5.6 - env: WP_VERSION=latest - - php: 5.6 - env: WP_VERSION=trunk - - php: 5.6 - env: WP_TRAVISCI=phpcs + - name: "PHP 5.4 Compatibility Test" + php: "5.4" + env: TEST_VERSION=5.4 + - name: "PHP 5.5 Compatibility Test" + php: "5.5" + env: TEST_VERSION=5.5 + - name: "PHP 5.6 Compatibility Test" + php: "5.6" + env: TEST_VERSION=5.6 + - name: "PHP7.0 Compatibility Test" + php: "7.0" + env: TEST_VERSION=7.0 + - name: "PHP 7.1 Compatibility Test" + php: "7.1" + env: TEST_VERSION=7.1 + - name: "PHP 7.2 Compatibility Test" + php: "7.2" + env: TEST_VERSION=7.2 + - name: "PHP 7.3 Compatibility Test" + php: "7.3" + env: TEST_VERSION=7.3 before_script: - - export PATH="$HOME/.composer/vendor/bin:$PATH" - - | - if [ -f ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini ]; then - phpenv config-rm xdebug.ini - else - echo "xdebug.ini does not exist" - fi - - | - if [[ ! -z "$WP_VERSION" ]] ; then - bash bin/install-wp-tests.sh wordpress_test root '' localhost $WP_VERSION - composer global require "phpunit/phpunit=4.8.*|5.7.*" - fi - - | - if [[ "$WP_TRAVISCI" == "phpcs" ]] ; then - composer global require wp-coding-standards/wpcs - phpcs --config-set installed_paths $HOME/.composer/vendor/wp-coding-standards/wpcs - fi - + - composer install script: - - | - if [[ ! -z "$WP_VERSION" ]] ; then - phpunit ./phpunit.xml.dist - WP_MULTISITE=1 phpunit ./phpunit.xml.dist - fi - - | - if [[ "$WP_TRAVISCI" == "phpcs" ]] ; then - phpcs - fi +- composer install --dev +- vendor/bin/phpcs -p src/ --standard=PHPCompatibility --runtime-set testVersion $TEST_VERSION diff --git a/bin/install-wp-tests.sh b/bin/install-wp-tests.sh deleted file mode 100755 index 5ceac4b84..000000000 --- a/bin/install-wp-tests.sh +++ /dev/null @@ -1,155 +0,0 @@ -#!/usr/bin/env bash - -if [ $# -lt 3 ]; then - echo "usage: $0 [db-host] [wp-version] [skip-database-creation]" - exit 1 -fi - -DB_NAME=$1 -DB_USER=$2 -DB_PASS=$3 -DB_HOST=${4-localhost} -WP_VERSION=${5-latest} -SKIP_DB_CREATE=${6-false} - -TMPDIR=${TMPDIR-/tmp} -TMPDIR=$(echo $TMPDIR | sed -e "s/\/$//") -WP_TESTS_DIR=${WP_TESTS_DIR-$TMPDIR/wordpress-tests-lib} -WP_CORE_DIR=${WP_CORE_DIR-$TMPDIR/wordpress/} - -download() { - if [ `which curl` ]; then - curl -s "$1" > "$2"; - elif [ `which wget` ]; then - wget -nv -O "$2" "$1" - fi -} - -if [[ $WP_VERSION =~ ^[0-9]+\.[0-9]+\-(beta|RC)[0-9]+$ ]]; then - WP_BRANCH=${WP_VERSION%\-*} - WP_TESTS_TAG="branches/$WP_BRANCH" - -elif [[ $WP_VERSION =~ ^[0-9]+\.[0-9]+$ ]]; then - WP_TESTS_TAG="branches/$WP_VERSION" -elif [[ $WP_VERSION =~ [0-9]+\.[0-9]+\.[0-9]+ ]]; then - if [[ $WP_VERSION =~ [0-9]+\.[0-9]+\.[0] ]]; then - # version x.x.0 means the first release of the major version, so strip off the .0 and download version x.x - WP_TESTS_TAG="tags/${WP_VERSION%??}" - else - WP_TESTS_TAG="tags/$WP_VERSION" - fi -elif [[ $WP_VERSION == 'nightly' || $WP_VERSION == 'trunk' ]]; then - WP_TESTS_TAG="trunk" -else - # http serves a single offer, whereas https serves multiple. we only want one - download http://api.wordpress.org/core/version-check/1.7/ /tmp/wp-latest.json - grep '[0-9]+\.[0-9]+(\.[0-9]+)?' /tmp/wp-latest.json - LATEST_VERSION=$(grep -o '"version":"[^"]*' /tmp/wp-latest.json | sed 's/"version":"//') - if [[ -z "$LATEST_VERSION" ]]; then - echo "Latest WordPress version could not be found" - exit 1 - fi - WP_TESTS_TAG="tags/$LATEST_VERSION" -fi -set -ex - -install_wp() { - - if [ -d $WP_CORE_DIR ]; then - return; - fi - - mkdir -p $WP_CORE_DIR - - if [[ $WP_VERSION == 'nightly' || $WP_VERSION == 'trunk' ]]; then - mkdir -p $TMPDIR/wordpress-nightly - download https://wordpress.org/nightly-builds/wordpress-latest.zip $TMPDIR/wordpress-nightly/wordpress-nightly.zip - unzip -q $TMPDIR/wordpress-nightly/wordpress-nightly.zip -d $TMPDIR/wordpress-nightly/ - mv $TMPDIR/wordpress-nightly/wordpress/* $WP_CORE_DIR - else - if [ $WP_VERSION == 'latest' ]; then - local ARCHIVE_NAME='latest' - elif [[ $WP_VERSION =~ [0-9]+\.[0-9]+ ]]; then - # https serves multiple offers, whereas http serves single. - download https://api.wordpress.org/core/version-check/1.7/ $TMPDIR/wp-latest.json - if [[ $WP_VERSION =~ [0-9]+\.[0-9]+\.[0] ]]; then - # version x.x.0 means the first release of the major version, so strip off the .0 and download version x.x - LATEST_VERSION=${WP_VERSION%??} - else - # otherwise, scan the releases and get the most up to date minor version of the major release - local VERSION_ESCAPED=`echo $WP_VERSION | sed 's/\./\\\\./g'` - LATEST_VERSION=$(grep -o '"version":"'$VERSION_ESCAPED'[^"]*' $TMPDIR/wp-latest.json | sed 's/"version":"//' | head -1) - fi - if [[ -z "$LATEST_VERSION" ]]; then - local ARCHIVE_NAME="wordpress-$WP_VERSION" - else - local ARCHIVE_NAME="wordpress-$LATEST_VERSION" - fi - else - local ARCHIVE_NAME="wordpress-$WP_VERSION" - fi - download https://wordpress.org/${ARCHIVE_NAME}.tar.gz $TMPDIR/wordpress.tar.gz - tar --strip-components=1 -zxmf $TMPDIR/wordpress.tar.gz -C $WP_CORE_DIR - fi - - download https://raw.github.com/markoheijnen/wp-mysqli/master/db.php $WP_CORE_DIR/wp-content/db.php -} - -install_test_suite() { - # portable in-place argument for both GNU sed and Mac OSX sed - if [[ $(uname -s) == 'Darwin' ]]; then - local ioption='-i.bak' - else - local ioption='-i' - fi - - # set up testing suite if it doesn't yet exist - if [ ! -d $WP_TESTS_DIR ]; then - # set up testing suite - mkdir -p $WP_TESTS_DIR - svn co --quiet https://develop.svn.wordpress.org/${WP_TESTS_TAG}/tests/phpunit/includes/ $WP_TESTS_DIR/includes - svn co --quiet https://develop.svn.wordpress.org/${WP_TESTS_TAG}/tests/phpunit/data/ $WP_TESTS_DIR/data - fi - - if [ ! -f wp-tests-config.php ]; then - download https://develop.svn.wordpress.org/${WP_TESTS_TAG}/wp-tests-config-sample.php "$WP_TESTS_DIR"/wp-tests-config.php - # remove all forward slashes in the end - WP_CORE_DIR=$(echo $WP_CORE_DIR | sed "s:/\+$::") - sed $ioption "s:dirname( __FILE__ ) . '/src/':'$WP_CORE_DIR/':" "$WP_TESTS_DIR"/wp-tests-config.php - sed $ioption "s/youremptytestdbnamehere/$DB_NAME/" "$WP_TESTS_DIR"/wp-tests-config.php - sed $ioption "s/yourusernamehere/$DB_USER/" "$WP_TESTS_DIR"/wp-tests-config.php - sed $ioption "s/yourpasswordhere/$DB_PASS/" "$WP_TESTS_DIR"/wp-tests-config.php - sed $ioption "s|localhost|${DB_HOST}|" "$WP_TESTS_DIR"/wp-tests-config.php - fi - -} - -install_db() { - - if [ ${SKIP_DB_CREATE} = "true" ]; then - return 0 - fi - - # parse DB_HOST for port or socket references - local PARTS=(${DB_HOST//\:/ }) - local DB_HOSTNAME=${PARTS[0]}; - local DB_SOCK_OR_PORT=${PARTS[1]}; - local EXTRA="" - - if ! [ -z $DB_HOSTNAME ] ; then - if [ $(echo $DB_SOCK_OR_PORT | grep -e '^[0-9]\{1,\}$') ]; then - EXTRA=" --host=$DB_HOSTNAME --port=$DB_SOCK_OR_PORT --protocol=tcp" - elif ! [ -z $DB_SOCK_OR_PORT ] ; then - EXTRA=" --socket=$DB_SOCK_OR_PORT" - elif ! [ -z $DB_HOSTNAME ] ; then - EXTRA=" --host=$DB_HOSTNAME --protocol=tcp" - fi - fi - - # create database - mysqladmin create $DB_NAME --user="$DB_USER" --password="$DB_PASS"$EXTRA -} - -install_wp -install_test_suite -install_db diff --git a/composer.json b/composer.json index 9286b49d9..bcedddeb0 100644 --- a/composer.json +++ b/composer.json @@ -12,5 +12,10 @@ ], "require": { "composer/installers": "~1.0" + }, + "require-dev": { + "squizlabs/php_codesniffer": "*", + "wimg/php-compatibility": "*", + "dealerdirect/phpcodesniffer-composer-installer": "^0.4.4" } } diff --git a/composer.lock b/composer.lock index 749677b84..ae2dc7a67 100644 --- a/composer.lock +++ b/composer.lock @@ -1,43 +1,46 @@ { "_readme": [ "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "hash": "fc1263f1ad59f2bc5b395c9c2d601d16", + "content-hash": "ebb80c6b0e6f29e301b37472dcc8d524", "packages": [ { "name": "composer/installers", - "version": "dev-master", + "version": "v1.6.0", "source": { "type": "git", "url": "https://github.com/composer/installers.git", - "reference": "e420b539e8d7b38b7c6f3f99dccc0386bd3dfe41" + "reference": "cfcca6b1b60bc4974324efb5783c13dca6932b5b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/installers/zipball/e420b539e8d7b38b7c6f3f99dccc0386bd3dfe41", - "reference": "e420b539e8d7b38b7c6f3f99dccc0386bd3dfe41", + "url": "https://api.github.com/repos/composer/installers/zipball/cfcca6b1b60bc4974324efb5783c13dca6932b5b", + "reference": "cfcca6b1b60bc4974324efb5783c13dca6932b5b", "shasum": "" }, + "require": { + "composer-plugin-api": "^1.0" + }, "replace": { "roundcube/plugin-installer": "*", "shama/baton": "*" }, "require-dev": { "composer/composer": "1.0.*@dev", - "phpunit/phpunit": "4.1.*" + "phpunit/phpunit": "^4.8.36" }, - "type": "composer-installer", + "type": "composer-plugin", "extra": { - "class": "Composer\\Installers\\Installer", + "class": "Composer\\Installers\\Plugin", "branch-alias": { "dev-master": "1.0-dev" } }, "autoload": { - "psr-0": { - "Composer\\Installers\\": "src/" + "psr-4": { + "Composer\\Installers\\": "src/Composer/Installers" } }, "notification-url": "https://packagist.org/downloads/", @@ -52,57 +55,258 @@ } ], "description": "A multi-framework Composer library installer", - "homepage": "http://composer.github.com/installers/", + "homepage": "https://composer.github.io/installers/", "keywords": [ "Craft", "Dolibarr", + "Eliasis", "Hurad", + "ImageCMS", + "Kanboard", + "Lan Management System", "MODX Evo", + "Mautic", + "Maya", "OXID", + "Plentymarkets", + "Porto", + "RadPHP", "SMF", "Thelia", "WolfCMS", "agl", "aimeos", "annotatecms", + "attogram", "bitrix", "cakephp", "chef", + "cockpit", "codeigniter", "concrete5", "croogo", "dokuwiki", "drupal", + "eZ Platform", "elgg", + "expressionengine", "fuelphp", "grav", "installer", + "itop", "joomla", "kohana", "laravel", + "lavalite", "lithium", "magento", + "majima", "mako", "mediawiki", "modulework", + "modx", "moodle", + "osclass", "phpbb", "piwik", "ppi", "puppet", + "pxcms", + "reindex", "roundcube", "shopware", "silverstripe", + "sydes", "symfony", "typo3", "wordpress", + "yawik", "zend", "zikula" ], - "time": "2015-06-13 15:30:38" + "time": "2018-08-27T06:10:37+00:00" + } + ], + "packages-dev": [ + { + "name": "dealerdirect/phpcodesniffer-composer-installer", + "version": "v0.4.4", + "source": { + "type": "git", + "url": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer.git", + "reference": "2e41850d5f7797cbb1af7b030d245b3b24e63a08" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/2e41850d5f7797cbb1af7b030d245b3b24e63a08", + "reference": "2e41850d5f7797cbb1af7b030d245b3b24e63a08", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.0", + "php": "^5.3|^7", + "squizlabs/php_codesniffer": "*" + }, + "require-dev": { + "composer/composer": "*", + "wimg/php-compatibility": "^8.0" + }, + "suggest": { + "dealerdirect/qa-tools": "All the PHP QA tools you'll need" + }, + "type": "composer-plugin", + "extra": { + "class": "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin" + }, + "autoload": { + "psr-4": { + "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Franck Nijhof", + "email": "f.nijhof@dealerdirect.nl", + "homepage": "http://workingatdealerdirect.eu", + "role": "Developer" + } + ], + "description": "PHP_CodeSniffer Standards Composer Installer Plugin", + "homepage": "http://workingatdealerdirect.eu", + "keywords": [ + "PHPCodeSniffer", + "PHP_CodeSniffer", + "code quality", + "codesniffer", + "composer", + "installer", + "phpcs", + "plugin", + "qa", + "quality", + "standard", + "standards", + "style guide", + "stylecheck", + "tests" + ], + "time": "2017-12-06T16:27:17+00:00" + }, + { + "name": "squizlabs/php_codesniffer", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", + "reference": "d86ad3c3d8a6cb40f45a377695d8f35b592ca821" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/d86ad3c3d8a6cb40f45a377695d8f35b592ca821", + "reference": "d86ad3c3d8a6cb40f45a377695d8f35b592ca821", + "shasum": "" + }, + "require": { + "ext-simplexml": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" + }, + "bin": [ + "bin/phpcs", + "bin/phpcbf" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Greg Sherwood", + "role": "lead" + } + ], + "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", + "homepage": "http://www.squizlabs.com/php-codesniffer", + "keywords": [ + "phpcs", + "standards" + ], + "time": "2019-01-14T05:30:36+00:00" + }, + { + "name": "wimg/php-compatibility", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/PHPCompatibility/PHPCompatibility.git", + "reference": "cac8ef629aa14a8d5148b1b56d09b657904604bb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibility/zipball/cac8ef629aa14a8d5148b1b56d09b657904604bb", + "reference": "cac8ef629aa14a8d5148b1b56d09b657904604bb", + "shasum": "" + }, + "require": { + "php": ">=5.3", + "squizlabs/php_codesniffer": "^2.3 || ^3.0.2" + }, + "conflict": { + "squizlabs/php_codesniffer": "2.6.2" + }, + "require-dev": { + "phpunit/phpunit": "~4.5 || ^5.0 || ^6.0 || ^7.0" + }, + "suggest": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.4.3 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically.", + "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues." + }, + "type": "phpcodesniffer-standard", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Contributors", + "homepage": "https://github.com/PHPCompatibility/PHPCompatibility/graphs/contributors" + }, + { + "name": "Wim Godden", + "homepage": "https://github.com/wimg", + "role": "lead" + }, + { + "name": "Juliette Reinders Folmer", + "homepage": "https://github.com/jrfnl", + "role": "lead" + } + ], + "description": "A set of sniffs for PHP_CodeSniffer that checks for PHP cross-version compatibility.", + "homepage": "http://techblog.wimgodden.be/tag/codesniffer/", + "keywords": [ + "compatibility", + "phpcs", + "standards" + ], + "abandoned": "phpcompatibility/php-compatibility", + "time": "2019-01-13T22:26:44+00:00" } ], - "packages-dev": [], "aliases": [], "minimum-stability": "dev", "stability-flags": [], diff --git a/library/enqueue-scripts.php b/library/enqueue-scripts.php index 661e854d7..0a7343b6d 100644 --- a/library/enqueue-scripts.php +++ b/library/enqueue-scripts.php @@ -22,7 +22,7 @@ function foundationpress_asset_path( $filename ) { if ( file_exists( $manifest_path ) ) { $manifest = json_decode( file_get_contents( $manifest_path ), true ); } else { - $manifest = []; + $manifest = array(); } if ( array_key_exists( $filename, $manifest ) ) { diff --git a/tests/bootstrap.php b/tests/bootstrap.php deleted file mode 100644 index 778b1dea3..000000000 --- a/tests/bootstrap.php +++ /dev/null @@ -1,48 +0,0 @@ -assertTrue( true ); - } -} From f122eecc522f82089647130bdb2371bb6ff1f5d2 Mon Sep 17 00:00:00 2001 From: Julian Weiland Date: Tue, 15 Jan 2019 11:27:51 +0100 Subject: [PATCH 6/8] required php compatibility changed --- .travis.yml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 291a84b51..8f12f8cb3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,12 +2,6 @@ language: php matrix: include: - - name: "PHP 5.4 Compatibility Test" - php: "5.4" - env: TEST_VERSION=5.4 - - name: "PHP 5.5 Compatibility Test" - php: "5.5" - env: TEST_VERSION=5.5 - name: "PHP 5.6 Compatibility Test" php: "5.6" env: TEST_VERSION=5.6 @@ -23,6 +17,16 @@ matrix: - name: "PHP 7.3 Compatibility Test" php: "7.3" env: TEST_VERSION=7.3 + allow_failures: + - name: "PHP 5.3 Compatibility Test" + php: "5.3" + env: TEST_VERSION=5.3 + - name: "PHP 5.4 Compatibility Test" + php: "5.4" + env: TEST_VERSION=5.4 + - name: "PHP 5.5 Compatibility Test" + php: "5.5" + env: TEST_VERSION=5.5 before_script: - composer install From 497acc50a3fd0d41ac64ed2a1d531b47c52411f9 Mon Sep 17 00:00:00 2001 From: Julian Weiland Date: Tue, 15 Jan 2019 11:29:23 +0100 Subject: [PATCH 7/8] travis.yml updated --- .travis.yml | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8f12f8cb3..7ce0def7e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,31 +2,31 @@ language: php matrix: include: - - name: "PHP 5.6 Compatibility Test" - php: "5.6" - env: TEST_VERSION=5.6 - - name: "PHP7.0 Compatibility Test" - php: "7.0" - env: TEST_VERSION=7.0 - - name: "PHP 7.1 Compatibility Test" - php: "7.1" - env: TEST_VERSION=7.1 - - name: "PHP 7.2 Compatibility Test" - php: "7.2" - env: TEST_VERSION=7.2 - - name: "PHP 7.3 Compatibility Test" - php: "7.3" - env: TEST_VERSION=7.3 + - name: "PHP 5.6 Compatibility Test" + php: "5.6" + env: TEST_VERSION=5.6 + - name: "PHP7.0 Compatibility Test" + php: "7.0" + env: TEST_VERSION=7.0 + - name: "PHP 7.1 Compatibility Test" + php: "7.1" + env: TEST_VERSION=7.1 + - name: "PHP 7.2 Compatibility Test" + php: "7.2" + env: TEST_VERSION=7.2 + - name: "PHP 7.3 Compatibility Test" + php: "7.3" + env: TEST_VERSION=7.3 allow_failures: - - name: "PHP 5.3 Compatibility Test" - php: "5.3" - env: TEST_VERSION=5.3 - - name: "PHP 5.4 Compatibility Test" - php: "5.4" - env: TEST_VERSION=5.4 - - name: "PHP 5.5 Compatibility Test" - php: "5.5" - env: TEST_VERSION=5.5 + - name: "PHP 5.3 Compatibility Test" + php: "5.3" + env: TEST_VERSION=5.3 + - name: "PHP 5.4 Compatibility Test" + php: "5.4" + env: TEST_VERSION=5.4 + - name: "PHP 5.5 Compatibility Test" + php: "5.5" + env: TEST_VERSION=5.5 before_script: - composer install From 987feb8de34036358976c0c92aa63699ba0ece70 Mon Sep 17 00:00:00 2001 From: Julian Weiland Date: Tue, 15 Jan 2019 11:30:13 +0100 Subject: [PATCH 8/8] travis test fix composer install command was called twice --- .travis.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7ce0def7e..d0d1594d4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,7 +29,6 @@ matrix: env: TEST_VERSION=5.5 before_script: - - composer install + - composer install --dev script: -- composer install --dev -- vendor/bin/phpcs -p src/ --standard=PHPCompatibility --runtime-set testVersion $TEST_VERSION + - vendor/bin/phpcs -p src/ --standard=PHPCompatibility --runtime-set testVersion $TEST_VERSION