From 33153b8f3a2e4974ae5b1e9f4017f669e35207fe Mon Sep 17 00:00:00 2001 From: Klaus Weidenbach Date: Sat, 22 Oct 2016 22:43:25 +0200 Subject: [FEATURE] :construction_worker: Extend Travis CI integration. Testing several Travis CI features. Add DBs to travis execution matrix. Doxygen API docu generation and deployment to gh-pages. Update phpunit to 5.7. --- .gitignore | 3 +- .travis.yml | 133 ++++++++++++++++++++++++++++++++++-------- composer.json | 2 +- tests/phpunit-mariadb.xml | 1 + tests/phpunit-mysql.xml | 37 ++++++++++++ tests/phpunit-pgsql.xml | 34 +++++++++++ tests/travis/gen_apidocs.sh | 86 +++++++++++++++++++++++++++ tests/travis/prepare.sh | 35 +++++++++++ tests/travis/prepare_mysql.sh | 37 ++++++++++++ tests/travis/prepare_pgsql.sh | 37 ++++++++++++ 10 files changed, 378 insertions(+), 27 deletions(-) create mode 120000 tests/phpunit-mariadb.xml create mode 100644 tests/phpunit-mysql.xml create mode 100644 tests/phpunit-pgsql.xml create mode 100755 tests/travis/gen_apidocs.sh create mode 100755 tests/travis/prepare.sh create mode 100755 tests/travis/prepare_mysql.sh create mode 100755 tests/travis/prepare_pgsql.sh diff --git a/.gitignore b/.gitignore index 039a8f530..050902f17 100755 --- a/.gitignore +++ b/.gitignore @@ -44,7 +44,8 @@ doc/html/ .zotshrc # external repositories for themes/addons extend/ - +# files generated by phpunit +tests/results/ ## exclude IDE files # config files and folders from Eclipse diff --git a/.travis.yml b/.travis.yml index 3570fe411..6938033ce 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,44 +1,127 @@ +# +# Travis-CI configuration file +# +## configure things +# + # see http://about.travis-ci.org/docs/user/languages/php/ for more hints language: php -# list any PHP version you want to test against -php: - # using major version aliases +# use docker based containers +sudo: false + +# Git branches whitelist to build on Travis CI +branches: + only: + - master + - dev - # aliased to a recent 5.6.x version - - 5.6 - # aliased to a recent 7.x version - - 7.0 - # aliased to a recent hhvm version - - hhvm +# Install additional software +addons: + # Install dependencies for generating API documentation with doxygen + apt: + packages: + - doxygen + - doxygen-latex + - graphviz + - ttf-liberation -# optionally specify a list of environments, for example to test different RDBMS -#env: -# - DB=mysql -# - DB=pgsql +# enable and start databases? +#services: +# - mariadb +# - postgresql + +# any PHP version we want to test against, our unit tests require PHP>=5.6 +php: + - '5.6' + - '7.0' + #- hhvm -# optionally set up exclutions and allowed failures in the matrix +# list of environments to test +env: + global: + # used for doxygen deployment script + - DOXYFILE: $TRAVIS_BUILD_DIR/util/Doxyfile + - GHP_REPO_REF: github.com/redmatrix/hubzilla.git + # Uncomment if a newer/specific version of Doxygen should be used + #- DOXY_VER: 1.8.12 + # use matrix only for PHP and MySQL, all other combinations added through includes + matrix: + - DB=mysql + +# Matrix configuration details matrix: + fast_finish: true + # Additional check combinations + include: + # PHP7, mariadb 10.1 + - php: '7.0' + env: DB=mariadb MARIADB_VERSION=10.1 + # use mariadb instead of MySQL + addons: + mariadb: '10.1' + # PHP7, PostgreSQL 9.4 + - php: '7.0' + env: DB=pgsql POSTGRESQL_VERSION=9.4 + # Use newer postgres than 9.1 default + addons: + postgresql: '9.4' + # Exclude from default matrix combinations # exclude: # - php: hhvm # env: DB=pgsql # PDO driver for pgsql is unsupported by HHVM (3rd party install for support) - allow_failures: - - php: hhvm -# execute any number of scripts before the test run, custom env's are available as variables -#before_script: -# - if [[ "$DB" == "pgsql" ]]; then psql -c "DROP DATABASE IF EXISTS hello_world_test;" -U postgres; fi -# - if [[ "$DB" == "pgsql" ]]; then psql -c "create database hello_world_test;" -U postgres; fi -# - if [[ "$DB" == "mysql" ]]; then mysql -e "create database IF NOT EXISTS hello_world_test;" -uroot; fi +# cache composer downloads between runs +cache: + directories: + - $HOME/.composer/cache + + +# +## execute things +# + +before_install: + - travis_retry composer self-update + +# Install composer dev libs install: - - composer install --optimize-autoloader + - travis_retry composer install --optimize-autoloader + +# execute any number of scripts before the test run, custom env's are available as variables +before_script: + # Some preparation tasks of environment + - ./tests/travis/prepare.sh + # DB specific prepare scripts + - if [[ "$DB" == "mysql" ]]; then ./tests/travis/prepare_mysql.sh; fi + - if [[ "$DB" == "mariadb" ]]; then ./tests/travis/prepare_mysql.sh; fi + - if [[ "$DB" == "pgsql" ]]; then ./tests/travis/prepare_pgsql.sh; fi # omitting "script:" will default to phpunit -# use the $DB env variable to determine the phpunit.xml to use -script: vendor/bin/phpunit tests/unit/ +script: ./vendor/bin/phpunit -c tests/phpunit-$DB.xml + +after_success: + # Generate API documentation and deploy it to gh-pages + - ./tests/travis/gen_apidocs.sh +#after_failure: + +# Deploying a release to GitHub when tagging in master +# Waiting for upcoming 'Build Stages' Q1/Q2 2017 to make generation of API docs +# and release packages cleaner. https://github.com/travis-ci/travis-ci/issues/929 +#before_deploy: +#deploy: +# skip_cleaning: true +# provider: releases +# on: +# tags: true +#after_deploy: + +#after_script: + + # configure notifications (email, IRC, campfire etc) -notifications: +#notifications: # irc: "irc.freenode.org#yourfavouriteroomfortravis" # a plugin/script to post to a hubzilla channel would be neat here diff --git a/composer.json b/composer.json index b59c81bba..f355566f2 100644 --- a/composer.json +++ b/composer.json @@ -34,7 +34,7 @@ }, "require-dev" : { "php" : ">=5.6", - "phpunit/phpunit" : "^5.6", + "phpunit/phpunit" : "^5.7", "behat/behat" : "@stable", "behat/mink-extension": "@stable", "behat/mink-goutte-driver": "@stable" diff --git a/tests/phpunit-mariadb.xml b/tests/phpunit-mariadb.xml new file mode 120000 index 000000000..63656b78b --- /dev/null +++ b/tests/phpunit-mariadb.xml @@ -0,0 +1 @@ +phpunit-mysql.xml \ No newline at end of file diff --git a/tests/phpunit-mysql.xml b/tests/phpunit-mysql.xml new file mode 100644 index 000000000..b421d7a7b --- /dev/null +++ b/tests/phpunit-mysql.xml @@ -0,0 +1,37 @@ + + + + ./unit/ + + + ./unit/ + + + ./unit/eximport/ + + + + postgresql + + + + + + ../Zotlabs/ + ../include/ + + + + + + + diff --git a/tests/phpunit-pgsql.xml b/tests/phpunit-pgsql.xml new file mode 100644 index 000000000..f59dd05ad --- /dev/null +++ b/tests/phpunit-pgsql.xml @@ -0,0 +1,34 @@ + + + + ./unit/ + + + ./unit/ + + + + mysql + + + + + + ../Zotlabs/ + ../include/ + + + + + + + diff --git a/tests/travis/gen_apidocs.sh b/tests/travis/gen_apidocs.sh new file mode 100755 index 000000000..dc25347c6 --- /dev/null +++ b/tests/travis/gen_apidocs.sh @@ -0,0 +1,86 @@ +#!/usr/bin/env bash + +# +# Copyright (c) 2016 Hubzilla +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +# + +# Exit if anything fails +set -e + +# Only create and deploy API documentation once, on first build job. +# Waiting for upcoming 'Build Stages' Q1/Q2 2017 to make this cleaner. +# https://github.com/travis-ci/travis-ci/issues/929 +if [[ "$TRAVIS_JOB_NUMBER" != "${TRAVIS_BUILD_NUMBER}.1" ]]; then + echo "Not the first build job. Creating API documentation only once is enough." + echo "We are finished ..." + exit +fi + +# @TODO get newer doxygen +echo "Doxygen version 1.7 is too old for us :(" +doxygen --version + +# Only build API documentation for master branch push +if [[ "$TRAVIS_EVENT_TYPE" != "push" ]] || [[ "$TRAVIS_BRANCH" != "master" ]]; then + echo "Conditions not met to build API documentation." + echo "We are finished ..." + exit +fi + +echo "Generating Doxygen API documentation for master ..." + +cd $TRAVIS_BUILD_DIR +mkdir -p ./doc/html + +# Redirect stderr and stdout to log file and console +doxygen $DOXYFILE 2>&1 | tee ./doc/html/doxygen.log + +# Check if GitHub token is configured in Travis to be able to push to the repo +if [ -z "$GHP_TOKEN" ]; then + echo "No GitHub token configured in Travis, can not deploy to gh-pages ..." + echo "Add Environment Variable 'GHP_TOKEN' in Travis CI project settings" + echo "with a 'Personal access token' from GitHub with 'repo:public_repo'." + exit +fi + +# Upload the API documentation to the gh-pages branch of the GitHub repository. +# Only upload if Doxygen successfully created the documentation. +if [ -d "doc/html" ] && [ -f "doc/html/index.html" ]; then + echo "Uploading API documentation to the gh-pages branch ..." + + # Add the new API documentation as a Git commit + cd ./doc/html + + # Create and configure a new git repo for committing to gh-pages + git init + # Add a fake Travis CI user + git config user.name "Travis CI" + git config user.email "travis@travis-ci.org" + # Add the generated API documentation + git add --all + git commit -q -m "API documentation generated by Travis build: ${TRAVIS_BUILD_NUMBER}" -m "From commit: ${TRAVIS_COMMIT}" + + # No need for a history, force push to the remote gh-pages branch + git push -f "https://${GHP_TOKEN}@${GHP_REPO_REF}" master:gh-pages > /dev/null 2>&1 +else + echo "No API documentation files have been found" >&2 + exit 1 +fi diff --git a/tests/travis/prepare.sh b/tests/travis/prepare.sh new file mode 100755 index 000000000..267b4ec46 --- /dev/null +++ b/tests/travis/prepare.sh @@ -0,0 +1,35 @@ +#!/usr/bin/env bash + +# +# Copyright (c) 2016 Hubzilla +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +# + +# Exit if anything fails +set -e + +# gd is required, show some info about the used one +php -r "var_dump(gd_info());" + + +echo "Creating required folders for Hubzilla ..." +mkdir -p ./store/\[data\]/smarty3 + +echo "TODO: create .htconfig" diff --git a/tests/travis/prepare_mysql.sh b/tests/travis/prepare_mysql.sh new file mode 100755 index 000000000..96a562ac3 --- /dev/null +++ b/tests/travis/prepare_mysql.sh @@ -0,0 +1,37 @@ +#!/usr/bin/env bash + +# +# Copyright (c) 2016 Hubzilla +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +# + +# Exit if anything fails +set -e + +echo "Preparing for MySQL ..." + +# Print out some MySQL information +mysql --version +mysql -e "SELECT VERSION();" +mysql -e "SHOW VARIABLES LIKE 'max_allowed_packet';" +mysql -e "SELECT @@sql_mode;" + +# Create Hubzilla database +mysql -e "CREATE DATABASE IF NOT EXISTS hubzilla;" -uroot; diff --git a/tests/travis/prepare_pgsql.sh b/tests/travis/prepare_pgsql.sh new file mode 100755 index 000000000..64c3524e7 --- /dev/null +++ b/tests/travis/prepare_pgsql.sh @@ -0,0 +1,37 @@ +#!/usr/bin/env bash + +# +# Copyright (c) 2016 Hubzilla +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +# + +# Exit if anything fails +set -e + +echo "Preparing for PostgreSQL ..." + +# Print out some PostgreSQL information +psql --version +# Why does this hang further execution of the job? +#psql -c "SELECT VERSION();" -U postgres + +# Create Hubzilla database +psql -c "DROP DATABASE IF EXISTS hubzilla;" -U postgres +psql -c "CREATE DATABASE hubzilla;" -U postgres -- cgit v1.2.3 From 03db9833e833959bb2414b736fddb967763d0d4f Mon Sep 17 00:00:00 2001 From: Klaus Weidenbach Date: Sun, 6 Nov 2016 21:31:02 +0100 Subject: :green_heart: Update Travis CI's Doxygen. Travis CI has Doxygen 1.7. We need 1.8 to generate our API documentation. Get a static version and use it. Always build API Documentation, but changed Doxygen configuration to only print out errors in the documentation generation, so these can be reviewed. --- .travis.yml | 6 ++++-- tests/travis/gen_apidocs.sh | 41 +++++++++++++++++++++++++++++------------ util/Doxyfile | 9 +++++++++ 3 files changed, 42 insertions(+), 14 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6938033ce..1412390ab 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,8 +21,9 @@ addons: # Install dependencies for generating API documentation with doxygen apt: packages: - - doxygen - - doxygen-latex + # default doxygen 1.7 is too old, we install our own + #- doxygen + #- doxygen-latex - graphviz - ttf-liberation @@ -75,6 +76,7 @@ matrix: cache: directories: - $HOME/.composer/cache + - $HOME/doxygen/doxygen-$DOXY_VER/bin diff --git a/tests/travis/gen_apidocs.sh b/tests/travis/gen_apidocs.sh index dc25347c6..248818117 100755 --- a/tests/travis/gen_apidocs.sh +++ b/tests/travis/gen_apidocs.sh @@ -34,25 +34,42 @@ if [[ "$TRAVIS_JOB_NUMBER" != "${TRAVIS_BUILD_NUMBER}.1" ]]; then exit fi -# @TODO get newer doxygen -echo "Doxygen version 1.7 is too old for us :(" -doxygen --version +# Get newer Doxygen +#echo "Doxygen version 1.7 is too old for us :(" +#doxygen --version -# Only build API documentation for master branch push -if [[ "$TRAVIS_EVENT_TYPE" != "push" ]] || [[ "$TRAVIS_BRANCH" != "master" ]]; then - echo "Conditions not met to build API documentation." - echo "We are finished ..." - exit +# Travis CI has an old Doxygen 1.7 build, so we fetch a recent static binary +export DOXY_BINPATH=$HOME/doxygen/doxygen-$DOXY_VER/bin +if [ ! -e "$DOXY_BINPATH/doxygen" ]; then + echo "Installing newer Doxygen $DOXY_VER ..." + mkdir -p $HOME/doxygen && cd $HOME/doxygen + wget -O - http://ftp.stack.nl/pub/users/dimitri/doxygen-$DOXY_VER.linux.bin.tar.gz | tar xz + export PATH=$PATH:$DOXY_BINPATH fi +echo "Doxygen version" +doxygen --version -echo "Generating Doxygen API documentation for master ..." - +echo "Generating Doxygen API documentation ..." cd $TRAVIS_BUILD_DIR mkdir -p ./doc/html - -# Redirect stderr and stdout to log file and console +# Redirect stderr and stdout to log file and console to be able to review documentation errors doxygen $DOXYFILE 2>&1 | tee ./doc/html/doxygen.log + +# There is no sane way yet, to prevent missuse of the push tokens in our workflow. +# We would need a way to limit a token to only push to gh-pages or a way to prevent +# manipulations to travis scripts which is not possible because we want it to run +# for pull requests. +# There are protected branches in GitHub, but they do not work for forced pushes. +exit + +# Only continue for master branch pushes +if [[ "$TRAVIS_EVENT_TYPE" != "push" ]] || [[ "$TRAVIS_BRANCH" != "master" ]]; then + echo "Conditions not met to build API documentation." + echo "We are finished ..." +# exit +fi + # Check if GitHub token is configured in Travis to be able to push to the repo if [ -z "$GHP_TOKEN" ]; then echo "No GitHub token configured in Travis, can not deploy to gh-pages ..." diff --git a/util/Doxyfile b/util/Doxyfile index f6c0692ee..1bca6cbd4 100644 --- a/util/Doxyfile +++ b/util/Doxyfile @@ -23,3 +23,12 @@ ALIASES += "TODO=\todo" ALIASES += "BUG=\bug" ALIASES += "hooks=\xrefitem hooks \"Hooks\" \"Hooks List\"" ALIASES += "HOOKS=\hooks" +# Output +QUIET = YES +WARNINGS = YES +# Dot tool config +HAVE_DOT = YES +DOT_IMAGE_FORMAT = svg +INTERACTIVE_SVG = YES +CLASS_GRAPH = YES +COLLABORATION_GRAPH = NO -- cgit v1.2.3 From 8e80500ee68972eef7d9c004823d1a547270334f Mon Sep 17 00:00:00 2001 From: Klaus Weidenbach Date: Mon, 5 Dec 2016 20:23:59 +0100 Subject: :construction_worker: use PHP7.1 and add PostgreSQL9.6 Use newer distro for Travis CI runs. New environment provides PostgreSQL9.6. Also no need to install custom Doxygen, made it optional. Changed default PHP environment from PHP7.0 to current PHP7.1. Changed codecoverage reporting. --- .travis.yml | 40 +++++++++++++++++++++++++--------------- tests/travis/gen_apidocs.sh | 25 +++++++++++++------------ tests/travis/prepare_pgsql.sh | 2 +- 3 files changed, 39 insertions(+), 28 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1412390ab..4fac4246a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ # -# Travis-CI configuration file +# Travis-CI configuration file for Hubzilla # ## configure things # @@ -7,6 +7,8 @@ # see http://about.travis-ci.org/docs/user/languages/php/ for more hints language: php +# use newer 'trusty' based distro, old one is 'precise' +dist: trusty # use docker based containers sudo: false @@ -21,9 +23,8 @@ addons: # Install dependencies for generating API documentation with doxygen apt: packages: - # default doxygen 1.7 is too old, we install our own - #- doxygen - #- doxygen-latex + - doxygen + - doxygen-latex - graphviz - ttf-liberation @@ -36,7 +37,8 @@ addons: php: - '5.6' - '7.0' - #- hhvm + - '7.1' + #- 'hhvm' # list of environments to test env: @@ -46,6 +48,8 @@ env: - GHP_REPO_REF: github.com/redmatrix/hubzilla.git # Uncomment if a newer/specific version of Doxygen should be used #- DOXY_VER: 1.8.12 + # Code Coverage is slow, no need to have it in every build + - PHPUCOV: "--no-coverage" # use matrix only for PHP and MySQL, all other combinations added through includes matrix: - DB=mysql @@ -55,18 +59,20 @@ matrix: fast_finish: true # Additional check combinations include: - # PHP7, mariadb 10.1 - - php: '7.0' - env: DB=mariadb MARIADB_VERSION=10.1 + # PHP7.1, mariadb 10.1 + - php: '7.1' + env: DB=mariadb MARIADB_VERSION=10.1 CODECOV=1 # use mariadb instead of MySQL addons: mariadb: '10.1' - # PHP7, PostgreSQL 9.4 - - php: '7.0' - env: DB=pgsql POSTGRESQL_VERSION=9.4 - # Use newer postgres than 9.1 default + # PHP7.1, PostgreSQL 9.6 + - php: '7.1' + env: DB=pgsql POSTGRESQL_VERSION=9.6 + # Use newer postgres than 9.2 default addons: - postgresql: '9.4' + postgresql: '9.6' + services: + - postgresql # Exclude from default matrix combinations # exclude: # - php: hhvm @@ -76,7 +82,7 @@ matrix: cache: directories: - $HOME/.composer/cache - - $HOME/doxygen/doxygen-$DOXY_VER/bin + #- $HOME/doxygen/doxygen-$DOXY_VER/bin @@ -93,6 +99,10 @@ install: # execute any number of scripts before the test run, custom env's are available as variables before_script: + # Use code coverage config for phpunit + - if [[ ! -z $CODECOV ]]; then export PHPUCOV=""; fi + # HHVM needs xdebug for code coverage, but extremely slow + #- if [[ $TRAVIS_PHP_VERSION =~ ^hhvm ]]; then echo 'xdebug.enable = On' >> /etc/hhvm/php.ini; fi # Some preparation tasks of environment - ./tests/travis/prepare.sh # DB specific prepare scripts @@ -101,7 +111,7 @@ before_script: - if [[ "$DB" == "pgsql" ]]; then ./tests/travis/prepare_pgsql.sh; fi # omitting "script:" will default to phpunit -script: ./vendor/bin/phpunit -c tests/phpunit-$DB.xml +script: ./vendor/bin/phpunit $PHPUCOV -c tests/phpunit-$DB.xml after_success: # Generate API documentation and deploy it to gh-pages diff --git a/tests/travis/gen_apidocs.sh b/tests/travis/gen_apidocs.sh index 248818117..ed5e429fa 100755 --- a/tests/travis/gen_apidocs.sh +++ b/tests/travis/gen_apidocs.sh @@ -34,20 +34,21 @@ if [[ "$TRAVIS_JOB_NUMBER" != "${TRAVIS_BUILD_NUMBER}.1" ]]; then exit fi -# Get newer Doxygen -#echo "Doxygen version 1.7 is too old for us :(" -#doxygen --version +echo "Doxygen version >= 1.8 is required" +doxygen --version -# Travis CI has an old Doxygen 1.7 build, so we fetch a recent static binary -export DOXY_BINPATH=$HOME/doxygen/doxygen-$DOXY_VER/bin -if [ ! -e "$DOXY_BINPATH/doxygen" ]; then - echo "Installing newer Doxygen $DOXY_VER ..." - mkdir -p $HOME/doxygen && cd $HOME/doxygen - wget -O - http://ftp.stack.nl/pub/users/dimitri/doxygen-$DOXY_VER.linux.bin.tar.gz | tar xz - export PATH=$PATH:$DOXY_BINPATH +# Check if newer version of Doxygen should be used +if [ ! -z "$DOXY_VER" ]; then + export DOXY_BINPATH=$HOME/doxygen/doxygen-$DOXY_VER/bin + if [ ! -e "$DOXY_BINPATH/doxygen" ]; then + echo "Installing newer Doxygen $DOXY_VER ..." + mkdir -p $HOME/doxygen && cd $HOME/doxygen + wget -O - http://ftp.stack.nl/pub/users/dimitri/doxygen-$DOXY_VER.linux.bin.tar.gz | tar xz + export PATH=$DOXY_BINPATH:$PATH + fi + echo "Doxygen version" + doxygen --version fi -echo "Doxygen version" -doxygen --version echo "Generating Doxygen API documentation ..." cd $TRAVIS_BUILD_DIR diff --git a/tests/travis/prepare_pgsql.sh b/tests/travis/prepare_pgsql.sh index 64c3524e7..dcd83f3be 100755 --- a/tests/travis/prepare_pgsql.sh +++ b/tests/travis/prepare_pgsql.sh @@ -30,7 +30,7 @@ echo "Preparing for PostgreSQL ..." # Print out some PostgreSQL information psql --version # Why does this hang further execution of the job? -#psql -c "SELECT VERSION();" -U postgres +psql -c "SELECT VERSION();" -U postgres # Create Hubzilla database psql -c "DROP DATABASE IF EXISTS hubzilla;" -U postgres -- cgit v1.2.3 From cb2eee1d2e82be62118482fb2668561c193a012b Mon Sep 17 00:00:00 2001 From: Klaus Weidenbach Date: Fri, 27 Jan 2017 21:56:21 +0100 Subject: :construction_worker: Add old MySQL 5.5 to Travis CI again. The trusty distro contains MySQL 5.6. Add a precise distro with MySQL 5.5. Unfortunately 5.7 is not yet provided, which would be interesting because of the enabled strict SQL mode. --- .travis.yml | 13 ++++++++++--- tests/phpunit-mysql.xml | 2 +- tests/travis/prepare_mysql.sh | 2 ++ 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4fac4246a..323c48f7f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,7 +28,7 @@ addons: - graphviz - ttf-liberation -# enable and start databases? +# enable and start databases on a per job basis #services: # - mariadb # - postgresql @@ -52,7 +52,8 @@ env: - PHPUCOV: "--no-coverage" # use matrix only for PHP and MySQL, all other combinations added through includes matrix: - - DB=mysql + # trusty default MySQL 5.6 + - DB=mysql MYSQL_VERSION=5.6 # Matrix configuration details matrix: @@ -73,7 +74,13 @@ matrix: postgresql: '9.6' services: - postgresql - # Exclude from default matrix combinations + # PHP7.1, old precise distribution with MySQL 5.5 + - php: '7.1' + env: DB=mysql MYSQL_VERSION=5.5 + dist: precise + services: + - mysql + # Excludes from default matrix combinations # exclude: # - php: hhvm # env: DB=pgsql # PDO driver for pgsql is unsupported by HHVM (3rd party install for support) diff --git a/tests/phpunit-mysql.xml b/tests/phpunit-mysql.xml index b421d7a7b..9ba40f087 100644 --- a/tests/phpunit-mysql.xml +++ b/tests/phpunit-mysql.xml @@ -6,7 +6,7 @@ beStrictAboutOutputDuringTests="true" beStrictAboutTestsThatDoNotTestAnything="true" beStrictAboutTodoAnnotatedTests="true" - processIsolation="true" + processIsolation="false" verbose="true"> ./unit/ diff --git a/tests/travis/prepare_mysql.sh b/tests/travis/prepare_mysql.sh index 96a562ac3..92c720205 100755 --- a/tests/travis/prepare_mysql.sh +++ b/tests/travis/prepare_mysql.sh @@ -31,6 +31,8 @@ echo "Preparing for MySQL ..." mysql --version mysql -e "SELECT VERSION();" mysql -e "SHOW VARIABLES LIKE 'max_allowed_packet';" +mysql -e "SHOW VARIABLES LIKE 'collation_%';" +mysql -e "SHOW VARIABLES LIKE 'character_set%';" mysql -e "SELECT @@sql_mode;" # Create Hubzilla database -- cgit v1.2.3 From 4a85726e5583e7de497077ded4e2ffbcd8b8a0b9 Mon Sep 17 00:00:00 2001 From: Klaus Weidenbach Date: Sun, 5 Feb 2017 01:38:12 +0100 Subject: :construction_worker: :arrow_up: :heavy_plus_sign: Update PHPUnit to current stable 6. Update requirements to PHP7 for dev. Add php-mock-phpunit to mock and stub global functions in a better way. --- .travis.yml | 6 +- composer.json | 7 +- composer.lock | 424 +++++++++++++++++++-------- tests/phpunit-mysql.xml | 12 +- tests/phpunit-pgsql.xml | 12 +- tests/unit/Lib/PermissionDescriptionTest.php | 129 ++++---- vendor/composer/autoload_classmap.php | 3 - vendor/composer/autoload_static.php | 3 - 8 files changed, 372 insertions(+), 224 deletions(-) diff --git a/.travis.yml b/.travis.yml index 323c48f7f..2d1771c1b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,11 +33,11 @@ addons: # - mariadb # - postgresql -# any PHP version we want to test against, our unit tests require PHP>=5.6 +# any PHP version we want to test against, current stable phpunit requires PHP >= 7.0 php: - - '5.6' - '7.0' - '7.1' + # HHVM does not fulfil PHPUnit platform requirements as being compatible with PHP7 yet #- 'hhvm' # list of environments to test @@ -108,8 +108,6 @@ install: before_script: # Use code coverage config for phpunit - if [[ ! -z $CODECOV ]]; then export PHPUCOV=""; fi - # HHVM needs xdebug for code coverage, but extremely slow - #- if [[ $TRAVIS_PHP_VERSION =~ ^hhvm ]]; then echo 'xdebug.enable = On' >> /etc/hhvm/php.ini; fi # Some preparation tasks of environment - ./tests/travis/prepare.sh # DB specific prepare scripts diff --git a/composer.json b/composer.json index f355566f2..868a89d19 100644 --- a/composer.json +++ b/composer.json @@ -33,11 +33,12 @@ "pixel418/markdownify": "^2.2" }, "require-dev" : { - "php" : ">=5.6", - "phpunit/phpunit" : "^5.7", + "php" : ">=7.0", + "phpunit/phpunit" : "^6.0", "behat/behat" : "@stable", "behat/mink-extension": "@stable", - "behat/mink-goutte-driver": "@stable" + "behat/mink-goutte-driver": "@stable", + "php-mock/php-mock-phpunit": "^2.0" }, "autoload" : { "psr-4" : { diff --git a/composer.lock b/composer.lock index 06fb17410..7541448f2 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "c0cafbf9fd702be588f6b392b9742cb6", + "content-hash": "0b382a501597bf5f59a5f22e85954cbe", "packages": [ { "name": "michelf/php-markdown", @@ -1113,21 +1113,21 @@ }, { "name": "guzzlehttp/guzzle", - "version": "6.2.2", + "version": "6.2.3", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "ebf29dee597f02f09f4d5bbecc68230ea9b08f60" + "reference": "8d6c6cc55186db87b7dc5009827429ba4e9dc006" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/ebf29dee597f02f09f4d5bbecc68230ea9b08f60", - "reference": "ebf29dee597f02f09f4d5bbecc68230ea9b08f60", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/8d6c6cc55186db87b7dc5009827429ba4e9dc006", + "reference": "8d6c6cc55186db87b7dc5009827429ba4e9dc006", "shasum": "" }, "require": { "guzzlehttp/promises": "^1.0", - "guzzlehttp/psr7": "^1.3.1", + "guzzlehttp/psr7": "^1.4", "php": ">=5.5" }, "require-dev": { @@ -1171,7 +1171,7 @@ "rest", "web service" ], - "time": "2016-10-08T15:01:37+00:00" + "time": "2017-02-28T22:50:30+00:00" }, { "name": "guzzlehttp/promises", @@ -1226,16 +1226,16 @@ }, { "name": "guzzlehttp/psr7", - "version": "1.4.0", + "version": "1.4.1", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "04a6d1a00ea5da0727ee94309a9f0d3dbaecb569" + "reference": "0d6c7ca039329247e4f0f8f8f6506810e8248855" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/04a6d1a00ea5da0727ee94309a9f0d3dbaecb569", - "reference": "04a6d1a00ea5da0727ee94309a9f0d3dbaecb569", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/0d6c7ca039329247e4f0f8f8f6506810e8248855", + "reference": "0d6c7ca039329247e4f0f8f8f6506810e8248855", "shasum": "" }, "require": { @@ -1287,7 +1287,7 @@ "uri", "url" ], - "time": "2017-02-21T01:20:32+00:00" + "time": "2017-02-27T10:51:17+00:00" }, { "name": "myclabs/deep-copy", @@ -1331,6 +1331,171 @@ ], "time": "2017-01-26T22:05:40+00:00" }, + { + "name": "php-mock/php-mock", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-mock/php-mock.git", + "reference": "22d297231118e6fd5b9db087fbe1ef866c2b95d2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-mock/php-mock/zipball/22d297231118e6fd5b9db087fbe1ef866c2b95d2", + "reference": "22d297231118e6fd5b9db087fbe1ef866c2b95d2", + "shasum": "" + }, + "require": { + "php": ">=5.6", + "phpunit/php-text-template": "^1" + }, + "replace": { + "malkusch/php-mock": "*" + }, + "require-dev": { + "phpunit/phpunit": "^5.7" + }, + "suggest": { + "php-mock/php-mock-phpunit": "Allows integration into PHPUnit testcase with the trait PHPMock." + }, + "type": "library", + "autoload": { + "psr-4": { + "phpmock\\": [ + "classes/", + "tests/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "WTFPL" + ], + "authors": [ + { + "name": "Markus Malkusch", + "email": "markus@malkusch.de", + "homepage": "http://markus.malkusch.de", + "role": "Developer" + } + ], + "description": "PHP-Mock can mock built-in PHP functions (e.g. time()). PHP-Mock relies on PHP's namespace fallback policy. No further extension is needed.", + "homepage": "https://github.com/php-mock/php-mock", + "keywords": [ + "BDD", + "TDD", + "function", + "mock", + "stub", + "test", + "test double" + ], + "time": "2017-02-17T20:52:52+00:00" + }, + { + "name": "php-mock/php-mock-integration", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-mock/php-mock-integration.git", + "reference": "5a0d7d7755f823bc2a230cfa45058b40f9013bc4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-mock/php-mock-integration/zipball/5a0d7d7755f823bc2a230cfa45058b40f9013bc4", + "reference": "5a0d7d7755f823bc2a230cfa45058b40f9013bc4", + "shasum": "" + }, + "require": { + "php": ">=5.6", + "php-mock/php-mock": "^2", + "phpunit/php-text-template": "^1" + }, + "require-dev": { + "phpunit/phpunit": "^4|^5" + }, + "type": "library", + "autoload": { + "psr-4": { + "phpmock\\integration\\": "classes/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "WTFPL" + ], + "authors": [ + { + "name": "Markus Malkusch", + "email": "markus@malkusch.de", + "homepage": "http://markus.malkusch.de", + "role": "Developer" + } + ], + "description": "Integration package for PHP-Mock", + "homepage": "https://github.com/php-mock/php-mock-integration", + "keywords": [ + "BDD", + "TDD", + "function", + "mock", + "stub", + "test", + "test double" + ], + "time": "2017-02-17T21:31:34+00:00" + }, + { + "name": "php-mock/php-mock-phpunit", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-mock/php-mock-phpunit.git", + "reference": "173781abdc632c59200253e12e2b991ae6a4574f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-mock/php-mock-phpunit/zipball/173781abdc632c59200253e12e2b991ae6a4574f", + "reference": "173781abdc632c59200253e12e2b991ae6a4574f", + "shasum": "" + }, + "require": { + "php": ">=7", + "php-mock/php-mock-integration": "^2", + "phpunit/phpunit": "^6" + }, + "type": "library", + "autoload": { + "psr-4": { + "phpmock\\phpunit\\": "classes/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "WTFPL" + ], + "authors": [ + { + "name": "Markus Malkusch", + "email": "markus@malkusch.de", + "homepage": "http://markus.malkusch.de", + "role": "Developer" + } + ], + "description": "Mock built-in PHP functions (e.g. time()) with PHPUnit. This package relies on PHP's namespace fallback policy. No further extension is needed.", + "homepage": "https://github.com/php-mock/php-mock-phpunit", + "keywords": [ + "BDD", + "TDD", + "function", + "mock", + "phpunit", + "stub", + "test", + "test double" + ], + "time": "2017-02-17T22:44:38+00:00" + }, { "name": "phpdocumentor/reflection-common", "version": "1.0", @@ -1479,27 +1644,27 @@ }, { "name": "phpspec/prophecy", - "version": "v1.6.2", + "version": "v1.7.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "6c52c2722f8460122f96f86346600e1077ce22cb" + "reference": "93d39f1f7f9326d746203c7c056f300f7f126073" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/6c52c2722f8460122f96f86346600e1077ce22cb", - "reference": "6c52c2722f8460122f96f86346600e1077ce22cb", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/93d39f1f7f9326d746203c7c056f300f7f126073", + "reference": "93d39f1f7f9326d746203c7c056f300f7f126073", "shasum": "" }, "require": { "doctrine/instantiator": "^1.0.2", "php": "^5.3|^7.0", "phpdocumentor/reflection-docblock": "^2.0|^3.0.2", - "sebastian/comparator": "^1.1", - "sebastian/recursion-context": "^1.0|^2.0" + "sebastian/comparator": "^1.1|^2.0", + "sebastian/recursion-context": "^1.0|^2.0|^3.0" }, "require-dev": { - "phpspec/phpspec": "^2.0", + "phpspec/phpspec": "^2.5|^3.2", "phpunit/phpunit": "^4.8 || ^5.6.5" }, "type": "library", @@ -1538,44 +1703,44 @@ "spy", "stub" ], - "time": "2016-11-21T14:58:47+00:00" + "time": "2017-03-02T20:05:34+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "4.0.6", + "version": "5.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "ca060f645beeddebedb1885c97bf163e93264c35" + "reference": "531553c4795a1df54114342d68ca337d5d81c8a0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/ca060f645beeddebedb1885c97bf163e93264c35", - "reference": "ca060f645beeddebedb1885c97bf163e93264c35", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/531553c4795a1df54114342d68ca337d5d81c8a0", + "reference": "531553c4795a1df54114342d68ca337d5d81c8a0", "shasum": "" }, "require": { - "php": "^5.6 || ^7.0", - "phpunit/php-file-iterator": "~1.3", - "phpunit/php-text-template": "~1.2", - "phpunit/php-token-stream": "^1.4.2 || ^2.0", - "sebastian/code-unit-reverse-lookup": "~1.0", - "sebastian/environment": "^1.3.2 || ^2.0", - "sebastian/version": "~1.0|~2.0" + "ext-dom": "*", + "ext-xmlwriter": "*", + "php": "^7.0", + "phpunit/php-file-iterator": "^1.3", + "phpunit/php-text-template": "^1.2", + "phpunit/php-token-stream": "^1.4.11 || ^2.0", + "sebastian/code-unit-reverse-lookup": "^1.0", + "sebastian/environment": "^2.0", + "sebastian/version": "^2.0" }, "require-dev": { - "ext-xdebug": ">=2.1.4", - "phpunit/phpunit": "^5.4" + "ext-xdebug": "^2.5", + "phpunit/phpunit": "^6.0" }, "suggest": { - "ext-dom": "*", - "ext-xdebug": ">=2.4.0", - "ext-xmlwriter": "*" + "ext-xdebug": "^2.5.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0.x-dev" + "dev-master": "5.0.x-dev" } }, "autoload": { @@ -1601,7 +1766,7 @@ "testing", "xunit" ], - "time": "2017-02-23T07:38:02+00:00" + "time": "2017-03-01T09:14:18+00:00" }, { "name": "phpunit/php-file-iterator", @@ -1693,25 +1858,30 @@ }, { "name": "phpunit/php-timer", - "version": "1.0.8", + "version": "1.0.9", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260" + "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/38e9124049cf1a164f1e4537caf19c99bf1eb260", - "reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", + "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^5.3.3 || ^7.0" }, "require-dev": { - "phpunit/phpunit": "~4|~5" + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, "autoload": { "classmap": [ "src/" @@ -1733,20 +1903,20 @@ "keywords": [ "timer" ], - "time": "2016-05-12T18:03:57+00:00" + "time": "2017-02-26T11:10:40+00:00" }, { "name": "phpunit/php-token-stream", - "version": "1.4.10", + "version": "1.4.11", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "284fb0679dd25fb5ffb56dad92c72860c0a22f1b" + "reference": "e03f8f67534427a787e21a385a67ec3ca6978ea7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/284fb0679dd25fb5ffb56dad92c72860c0a22f1b", - "reference": "284fb0679dd25fb5ffb56dad92c72860c0a22f1b", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/e03f8f67534427a787e21a385a67ec3ca6978ea7", + "reference": "e03f8f67534427a787e21a385a67ec3ca6978ea7", "shasum": "" }, "require": { @@ -1782,20 +1952,20 @@ "keywords": [ "tokenizer" ], - "time": "2017-02-23T06:14:45+00:00" + "time": "2017-02-27T10:12:30+00:00" }, { "name": "phpunit/phpunit", - "version": "5.7.14", + "version": "6.0.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "4906b8faf23e42612182fd212eb6f4c0f2954b57" + "reference": "47ee3fa1bca5c50f1d25105201eb20df777bd7b6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/4906b8faf23e42612182fd212eb6f4c0f2954b57", - "reference": "4906b8faf23e42612182fd212eb6f4c0f2954b57", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/47ee3fa1bca5c50f1d25105201eb20df777bd7b6", + "reference": "47ee3fa1bca5c50f1d25105201eb20df777bd7b6", "shasum": "" }, "require": { @@ -1804,33 +1974,33 @@ "ext-libxml": "*", "ext-mbstring": "*", "ext-xml": "*", - "myclabs/deep-copy": "~1.3", - "php": "^5.6 || ^7.0", + "myclabs/deep-copy": "^1.3", + "php": "^7.0", "phpspec/prophecy": "^1.6.2", - "phpunit/php-code-coverage": "^4.0.4", - "phpunit/php-file-iterator": "~1.4", - "phpunit/php-text-template": "~1.2", + "phpunit/php-code-coverage": "^5.0", + "phpunit/php-file-iterator": "^1.4", + "phpunit/php-text-template": "^1.2", "phpunit/php-timer": "^1.0.6", - "phpunit/phpunit-mock-objects": "^3.2", - "sebastian/comparator": "^1.2.4", - "sebastian/diff": "~1.2", - "sebastian/environment": "^1.3.4 || ^2.0", - "sebastian/exporter": "~2.0", - "sebastian/global-state": "^1.1", - "sebastian/object-enumerator": "~2.0", - "sebastian/resource-operations": "~1.0", - "sebastian/version": "~1.0.3|~2.0", - "symfony/yaml": "~2.1|~3.0" + "phpunit/phpunit-mock-objects": "^4.0", + "sebastian/comparator": "^1.2.4 || ^2.0", + "sebastian/diff": "^1.2", + "sebastian/environment": "^2.0", + "sebastian/exporter": "^2.0 || ^3.0", + "sebastian/global-state": "^1.1 || ^2.0", + "sebastian/object-enumerator": "^2.0 || ^3.0", + "sebastian/resource-operations": "^1.0", + "sebastian/version": "^2.0" }, "conflict": { - "phpdocumentor/reflection-docblock": "3.0.2" + "phpdocumentor/reflection-docblock": "3.0.2", + "phpunit/dbunit": "<3.0" }, "require-dev": { "ext-pdo": "*" }, "suggest": { "ext-xdebug": "*", - "phpunit/php-invoker": "~1.1" + "phpunit/php-invoker": "^1.1" }, "bin": [ "phpunit" @@ -1838,7 +2008,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "5.7.x-dev" + "dev-master": "6.0.x-dev" } }, "autoload": { @@ -1864,33 +2034,33 @@ "testing", "xunit" ], - "time": "2017-02-19T07:22:16+00:00" + "time": "2017-03-02T15:24:03+00:00" }, { "name": "phpunit/phpunit-mock-objects", - "version": "3.4.3", + "version": "4.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "3ab72b65b39b491e0c011e2e09bb2206c2aa8e24" + "reference": "eabce450df194817a7d7e27e19013569a903a2bf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/3ab72b65b39b491e0c011e2e09bb2206c2aa8e24", - "reference": "3ab72b65b39b491e0c011e2e09bb2206c2aa8e24", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/eabce450df194817a7d7e27e19013569a903a2bf", + "reference": "eabce450df194817a7d7e27e19013569a903a2bf", "shasum": "" }, "require": { "doctrine/instantiator": "^1.0.2", - "php": "^5.6 || ^7.0", + "php": "^7.0", "phpunit/php-text-template": "^1.2", - "sebastian/exporter": "^1.2 || ^2.0" + "sebastian/exporter": "^3.0" }, "conflict": { - "phpunit/phpunit": "<5.4.0" + "phpunit/phpunit": "<6.0" }, "require-dev": { - "phpunit/phpunit": "^5.4" + "phpunit/phpunit": "^6.0" }, "suggest": { "ext-soap": "*" @@ -1898,7 +2068,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.2.x-dev" + "dev-master": "4.0.x-dev" } }, "autoload": { @@ -1923,7 +2093,7 @@ "mock", "xunit" ], - "time": "2016-12-08T20:27:08+00:00" + "time": "2017-03-03T06:30:20+00:00" }, { "name": "psr/container", @@ -2026,23 +2196,23 @@ }, { "name": "sebastian/code-unit-reverse-lookup", - "version": "1.0.0", + "version": "1.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "c36f5e7cfce482fde5bf8d10d41a53591e0198fe" + "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/c36f5e7cfce482fde5bf8d10d41a53591e0198fe", - "reference": "c36f5e7cfce482fde5bf8d10d41a53591e0198fe", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", + "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", "shasum": "" }, "require": { - "php": ">=5.6" + "php": "^5.6 || ^7.0" }, "require-dev": { - "phpunit/phpunit": "~5" + "phpunit/phpunit": "^5.7 || ^6.0" }, "type": "library", "extra": { @@ -2067,34 +2237,34 @@ ], "description": "Looks up which function or method a line of code belongs to", "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", - "time": "2016-02-13T06:45:14+00:00" + "time": "2017-03-04T06:30:41+00:00" }, { "name": "sebastian/comparator", - "version": "1.2.4", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be" + "reference": "20f84f468cb67efee293246e6a09619b891f55f0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", - "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/20f84f468cb67efee293246e6a09619b891f55f0", + "reference": "20f84f468cb67efee293246e6a09619b891f55f0", "shasum": "" }, "require": { - "php": ">=5.3.3", - "sebastian/diff": "~1.2", - "sebastian/exporter": "~1.2 || ~2.0" + "php": "^7.0", + "sebastian/diff": "^1.2", + "sebastian/exporter": "^3.0" }, "require-dev": { - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "^6.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.2.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { @@ -2131,7 +2301,7 @@ "compare", "equality" ], - "time": "2017-01-29T09:50:25+00:00" + "time": "2017-03-03T06:26:08+00:00" }, { "name": "sebastian/diff", @@ -2237,30 +2407,30 @@ }, { "name": "sebastian/exporter", - "version": "2.0.0", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4" + "reference": "b82d077cb3459e393abcf4867ae8f7230dcb51f6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4", - "reference": "ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/b82d077cb3459e393abcf4867ae8f7230dcb51f6", + "reference": "b82d077cb3459e393abcf4867ae8f7230dcb51f6", "shasum": "" }, "require": { - "php": ">=5.3.3", - "sebastian/recursion-context": "~2.0" + "php": "^7.0", + "sebastian/recursion-context": "^3.0" }, "require-dev": { "ext-mbstring": "*", - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "^6.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "3.0.x-dev" } }, "autoload": { @@ -2300,7 +2470,7 @@ "export", "exporter" ], - "time": "2016-11-19T08:54:04+00:00" + "time": "2017-03-03T06:25:06+00:00" }, { "name": "sebastian/global-state", @@ -2355,29 +2525,29 @@ }, { "name": "sebastian/object-enumerator", - "version": "2.0.1", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "1311872ac850040a79c3c058bea3e22d0f09cbb7" + "reference": "de6e32f7192dfea2e4bedc892434f4830b5c5794" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/1311872ac850040a79c3c058bea3e22d0f09cbb7", - "reference": "1311872ac850040a79c3c058bea3e22d0f09cbb7", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/de6e32f7192dfea2e4bedc892434f4830b5c5794", + "reference": "de6e32f7192dfea2e4bedc892434f4830b5c5794", "shasum": "" }, "require": { - "php": ">=5.6", - "sebastian/recursion-context": "~2.0" + "php": "^7.0", + "sebastian/recursion-context": "^3.0" }, "require-dev": { - "phpunit/phpunit": "~5" + "phpunit/phpunit": "^6.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "3.0.x-dev" } }, "autoload": { @@ -2397,32 +2567,32 @@ ], "description": "Traverses array structures and object graphs to enumerate all referenced objects", "homepage": "https://github.com/sebastianbergmann/object-enumerator/", - "time": "2017-02-18T15:18:39+00:00" + "time": "2017-03-03T06:21:01+00:00" }, { "name": "sebastian/recursion-context", - "version": "2.0.0", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "2c3ba150cbec723aa057506e73a8d33bdb286c9a" + "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/2c3ba150cbec723aa057506e73a8d33bdb286c9a", - "reference": "2c3ba150cbec723aa057506e73a8d33bdb286c9a", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", + "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^7.0" }, "require-dev": { - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "^6.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "3.0.x-dev" } }, "autoload": { @@ -2450,7 +2620,7 @@ ], "description": "Provides functionality to recursively process PHP variables", "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2016-11-19T07:33:16+00:00" + "time": "2017-03-03T06:23:57+00:00" }, { "name": "sebastian/resource-operations", @@ -3354,6 +3524,6 @@ "ext-openssl": "*" }, "platform-dev": { - "php": ">=5.6" + "php": ">=7.0" } } diff --git a/tests/phpunit-mysql.xml b/tests/phpunit-mysql.xml index 9ba40f087..171211094 100644 --- a/tests/phpunit-mysql.xml +++ b/tests/phpunit-mysql.xml @@ -1,12 +1,11 @@ ./unit/ @@ -31,7 +30,8 @@ - + + diff --git a/tests/phpunit-pgsql.xml b/tests/phpunit-pgsql.xml index f59dd05ad..ace14e196 100644 --- a/tests/phpunit-pgsql.xml +++ b/tests/phpunit-pgsql.xml @@ -1,12 +1,11 @@ ./unit/ @@ -28,7 +27,8 @@ - + + diff --git a/tests/unit/Lib/PermissionDescriptionTest.php b/tests/unit/Lib/PermissionDescriptionTest.php index b1da5a0fd..97a39a2c8 100644 --- a/tests/unit/Lib/PermissionDescriptionTest.php +++ b/tests/unit/Lib/PermissionDescriptionTest.php @@ -1,6 +1,6 @@ assertEquals($permDesc, $permDesc2); + $this->assertNotEquals($permDesc, $permDesc3); + } - public function testFromDescription() { - $permDesc = PermissionDescription::fromDescription('test'); - $permDesc2 = PermissionDescription::fromDescription('test'); - $permDesc3 = PermissionDescription::fromDescription('test2'); + public function testFromStandalonePermission() { + // Create a stub for global function t() + $t = $this->getFunctionMock('Zotlabs\Lib', 't'); + $t->expects($this->atLeastOnce())->willReturnCallback( + function ($string) { + return $string; + } + ); + // Create a mock for global function logger() + $this->getFunctionMock('Zotlabs\Lib', 'logger'); - $this->assertEquals($permDesc, $permDesc2); - $this->assertNotEquals($permDesc, $permDesc3); - } + $permDescUnknown = PermissionDescription::fromStandalonePermission(-1); + $permDescSelf = PermissionDescription::fromStandalonePermission(0); - public function testFromStandalonePermission() { - $permDescUnknown = PermissionDescription::fromStandalonePermission(-1); - $permDescSelf = PermissionDescription::fromStandalonePermission(0); + $this->assertNull($permDescUnknown); + $this->assertNotNull($permDescSelf); + } - $this->assertNull($permDescUnknown); - $this->assertNotNull($permDescSelf); - } + public function testFromGlobalPermission() { + //$permDesc = PermissionDescription::fromGlobalPermission('view_profile'); - public function testFromGlobalPermission() { - //$permDesc = PermissionDescription::fromGlobalPermission('view_profile'); + $this->markTestIncomplete( + 'The method fromGlobalPermission() is not yet testable ...' + ); + } - $this->markTestIncomplete( - 'For this test we need more stubs...' - ); - } + public function testGetPermissionDescription() { + // Create a stub for global function t() + $t = $this->getFunctionMock('Zotlabs\Lib', 't'); + $t->expects($this->atLeastOnce())->willReturnCallback( + function ($string) { + return $string; + } + ); + // Create a mock for global function logger() + $this->getFunctionMock('Zotlabs\Lib', 'logger'); - public function testGetPermissionDescription() { + // Create a stub for the PermissionDescription class + $stub = $this->createMock(PermissionDescription::class); + $stub->method('get_permission_description') + ->will($this->returnArgument(0)); - // fromStandalonePermission uses get_permission_description(), so that will not help - //$permDescSelf = PermissionDescription::fromStandalonePermission(0); - //$permDescPublic = PermissionDescription::fromStandalonePermission(PERMS_PUBLIC); + $permDescSelf = PermissionDescription::fromStandalonePermission(0); + $this->assertInstanceOf(PermissionDescription::class, $permDescSelf); + $this->assertEquals($permDescSelf->get_permission_description(), 'Only me'); - $this->markTestIncomplete( - 'For this test we need a mock of PermissionDescription...' - ); - //$permDescSelf = - //$this->assertEquals($permDescSelf->, 'Only me'); - //$this->assertEquals($permDescPublic, 'Public'); - } + $permDescPublic = PermissionDescription::fromStandalonePermission(PERMS_PUBLIC); + $this->assertEquals($permDescPublic->get_permission_description(), 'Public'); } } diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php index 2adb2fe53..28ef0d2bf 100644 --- a/vendor/composer/autoload_classmap.php +++ b/vendor/composer/autoload_classmap.php @@ -361,9 +361,6 @@ return array( 'Sabre\\Xml\\Writer' => $vendorDir . '/sabre/xml/lib/Writer.php', 'Sabre\\Xml\\XmlDeserializable' => $vendorDir . '/sabre/xml/lib/XmlDeserializable.php', 'Sabre\\Xml\\XmlSerializable' => $vendorDir . '/sabre/xml/lib/XmlSerializable.php', - 'Test\\Markdownify\\ConverterExtraTest' => $vendorDir . '/pixel418/markdownify/test/ConverterExtraTest.php', - 'Test\\Markdownify\\ConverterTest' => $vendorDir . '/pixel418/markdownify/test/ConverterTest.php', - 'Test\\Markdownify\\ConverterTestCase' => $vendorDir . '/pixel418/markdownify/test/ConverterTestCase.php', 'Zotlabs\\Access\\AccessList' => $baseDir . '/Zotlabs/Access/AccessList.php', 'Zotlabs\\Access\\PermissionLimits' => $baseDir . '/Zotlabs/Access/PermissionLimits.php', 'Zotlabs\\Access\\PermissionRoles' => $baseDir . '/Zotlabs/Access/PermissionRoles.php', diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index a7c84b7f1..eb4311159 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -476,9 +476,6 @@ class ComposerStaticInit7b34d7e50a62201ec5d5e526a5b8b35d 'Sabre\\Xml\\Writer' => __DIR__ . '/..' . '/sabre/xml/lib/Writer.php', 'Sabre\\Xml\\XmlDeserializable' => __DIR__ . '/..' . '/sabre/xml/lib/XmlDeserializable.php', 'Sabre\\Xml\\XmlSerializable' => __DIR__ . '/..' . '/sabre/xml/lib/XmlSerializable.php', - 'Test\\Markdownify\\ConverterExtraTest' => __DIR__ . '/..' . '/pixel418/markdownify/test/ConverterExtraTest.php', - 'Test\\Markdownify\\ConverterTest' => __DIR__ . '/..' . '/pixel418/markdownify/test/ConverterTest.php', - 'Test\\Markdownify\\ConverterTestCase' => __DIR__ . '/..' . '/pixel418/markdownify/test/ConverterTestCase.php', 'Zotlabs\\Access\\AccessList' => __DIR__ . '/../..' . '/Zotlabs/Access/AccessList.php', 'Zotlabs\\Access\\PermissionLimits' => __DIR__ . '/../..' . '/Zotlabs/Access/PermissionLimits.php', 'Zotlabs\\Access\\PermissionRoles' => __DIR__ . '/../..' . '/Zotlabs/Access/PermissionRoles.php', -- cgit v1.2.3 From 5c080ca4e84d9c516d229b8a1248ad5aecf2fe0f Mon Sep 17 00:00:00 2001 From: Klaus Weidenbach Date: Fri, 10 Mar 2017 01:01:35 +0100 Subject: :construction_worker: Add Travis' GitHub deployment steps. Changed API documentation deployment to gh_pages to Travis's GitHub Pages deployment. Also add Travis GitHub Release Deployment step to offer API documentation. Both steps are optional and need to be activated in Travis by setting GH_TOKEN. --- .travis.yml | 30 ++++++++++++++++++++--------- tests/travis/gen_apidocs.sh | 47 ++++++--------------------------------------- 2 files changed, 27 insertions(+), 50 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2d1771c1b..e1aec9145 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,6 +17,8 @@ branches: only: - master - dev + # whitelist our tags for release deployments e.g. 2.2 + - /^\d+\.\d+(\.\d+)?(-\S*)?$/ # Install additional software addons: @@ -45,7 +47,6 @@ env: global: # used for doxygen deployment script - DOXYFILE: $TRAVIS_BUILD_DIR/util/Doxyfile - - GHP_REPO_REF: github.com/redmatrix/hubzilla.git # Uncomment if a newer/specific version of Doxygen should be used #- DOXY_VER: 1.8.12 # Code Coverage is slow, no need to have it in every build @@ -123,15 +124,26 @@ after_success: - ./tests/travis/gen_apidocs.sh #after_failure: -# Deploying a release to GitHub when tagging in master -# Waiting for upcoming 'Build Stages' Q1/Q2 2017 to make generation of API docs -# and release packages cleaner. https://github.com/travis-ci/travis-ci/issues/929 +# Deploying release and API documentation to GitHub #before_deploy: -#deploy: -# skip_cleaning: true -# provider: releases -# on: -# tags: true +deploy: + - provider: pages + skip_cleanup: true + local_dir: $TRAVIS_BUILD_DIR/doc/html + github_token: $GH_TOKEN + on: + repo: redmatrix/hubzilla + branch: master + condition: '(-n "$GH_TOKEN") && ("$TRAVIS_JOB_NUMBER" == "${TRAVIS_BUILD_NUMBER}.1")' + # add API documentation to release, could also be used to provide full packages if we want to drop vendor from our repo + - provider: releases + skip_cleanup: true + api_key: $GH_TOKEN + file: 'doc/hubzilla-api-documentation.zip' + on: + repo: redmatrix/hubzilla + tags: true + condition: '(-n "$GH_TOKEN") && ("$TRAVIS_JOB_NUMBER" == "${TRAVIS_BUILD_NUMBER}.1")' #after_deploy: #after_script: diff --git a/tests/travis/gen_apidocs.sh b/tests/travis/gen_apidocs.sh index ed5e429fa..e5938e1e8 100755 --- a/tests/travis/gen_apidocs.sh +++ b/tests/travis/gen_apidocs.sh @@ -56,48 +56,13 @@ mkdir -p ./doc/html # Redirect stderr and stdout to log file and console to be able to review documentation errors doxygen $DOXYFILE 2>&1 | tee ./doc/html/doxygen.log - -# There is no sane way yet, to prevent missuse of the push tokens in our workflow. -# We would need a way to limit a token to only push to gh-pages or a way to prevent -# manipulations to travis scripts which is not possible because we want it to run -# for pull requests. -# There are protected branches in GitHub, but they do not work for forced pushes. -exit - -# Only continue for master branch pushes -if [[ "$TRAVIS_EVENT_TYPE" != "push" ]] || [[ "$TRAVIS_BRANCH" != "master" ]]; then - echo "Conditions not met to build API documentation." - echo "We are finished ..." -# exit -fi - -# Check if GitHub token is configured in Travis to be able to push to the repo -if [ -z "$GHP_TOKEN" ]; then - echo "No GitHub token configured in Travis, can not deploy to gh-pages ..." - echo "Add Environment Variable 'GHP_TOKEN' in Travis CI project settings" - echo "with a 'Personal access token' from GitHub with 'repo:public_repo'." - exit -fi - -# Upload the API documentation to the gh-pages branch of the GitHub repository. -# Only upload if Doxygen successfully created the documentation. +# Check if Doxygen successfully created the documentation if [ -d "doc/html" ] && [ -f "doc/html/index.html" ]; then - echo "Uploading API documentation to the gh-pages branch ..." - - # Add the new API documentation as a Git commit - cd ./doc/html - - # Create and configure a new git repo for committing to gh-pages - git init - # Add a fake Travis CI user - git config user.name "Travis CI" - git config user.email "travis@travis-ci.org" - # Add the generated API documentation - git add --all - git commit -q -m "API documentation generated by Travis build: ${TRAVIS_BUILD_NUMBER}" -m "From commit: ${TRAVIS_COMMIT}" - - # No need for a history, force push to the remote gh-pages branch - git push -f "https://${GHP_TOKEN}@${GHP_REPO_REF}" master:gh-pages > /dev/null 2>&1 + echo "API documentation generated" + if [ -n "${TRAVIS_TAG}" ]; then + echo "Generate API documentation archive for release deployment ..." + zip -9 -r -q doc/hubzilla-api-documentation.zip doc/html/ + fi else echo "No API documentation files have been found" >&2 exit 1 -- cgit v1.2.3