From 82de17c6562c46be063cc84bebdfc8b50fd4a782 Mon Sep 17 00:00:00 2001 From: Hannes Papenberg Date: Sun, 30 Aug 2020 21:32:00 +0200 Subject: [PATCH] Switching from Travis to Drone Removing Hound artifacts --- .drone.yml | 773 ++++++++++++++++-- .hound.yml | 13 - .travis.yml | 63 -- README.md | 8 +- phpunit.xml.dist | 21 +- .../storage/JCacheStorageMemcachedTest.php | 9 +- .../cache/storage/JCacheStorageRedisTest.php | 80 +- travisci-phpunit.xml | 34 - 8 files changed, 744 insertions(+), 257 deletions(-) delete mode 100644 .hound.yml delete mode 100644 .travis.yml delete mode 100644 travisci-phpunit.xml diff --git a/.drone.yml b/.drone.yml index 8b240f0225b..a2d23588d2d 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,108 +1,713 @@ --- kind: pipeline -name: default +name: Codequality -clone: +platform: + os: linux + arch: amd64 steps: - - name: phpcs - image: joomlaprojects/docker-images:phpcs1.5 - commands: - - echo $(date) - - /usr/local/vendor/bin/phpcs --report=full --encoding=utf-8 --extensions=php -p --standard=build/phpcs/Joomla . - - echo $(date) +- name: composer + image: joomlaprojects/docker-images:php7.4 + commands: + - php -v + - composer install + - composer require phpmd/phpmd + volumes: + - name: composer-cache + path: /tmp/composer-cache - - name: restore-cache - image: drillster/drone-volume-cache - settings: - restore: true - mount: - - ./tests/javascript/node_modules - cache_key: [ DRONE_REPO_NAMESPACE, DRONE_REPO_NAME, DRONE_BRANCH, DRONE_STAGE_NUMBER ] - volumes: - - name: cache - path: /cache +- name: phpcs + image: joomlaprojects/docker-images:php7.2 + commands: + - php -v + - libraries/vendor/bin/phpcs --report=full --encoding=utf-8 --extensions=php -p --standard=build/phpcs/Joomla . - - name: javascript - image: joomlaprojects/docker-images:systemtests - commands: - - echo $(date) - - export DISPLAY=:0 - - Xvfb -screen 0 1024x768x24 -ac +extension GLX +render -noreset > /dev/null 2>&1 & - - sleep 3 - - fluxbox > /dev/null 2>&1 & - - cd tests/javascript - - npm install - - cd ../.. - - tests/javascript/node_modules/karma/bin/karma start karma.conf.js --single-run - - echo $(date) +- name: javascript + image: joomlaprojects/docker-images:systemtests + commands: + - echo $(date) + - export DISPLAY=:0 + - Xvfb -screen 0 1024x768x24 -ac +extension GLX +render -noreset > /dev/null 2>&1 & + - sleep 3 + - fluxbox > /dev/null 2>&1 & + - cd tests/javascript + - npm install + - cd ../.. + - tests/javascript/node_modules/karma/bin/karma start karma.conf.js --single-run + - echo $(date) - - name: rebuild-cache - image: drillster/drone-volume-cache - settings: - rebuild: true - mount: - - ./tests/javascript/node_modules - cache_key: [ DRONE_REPO_NAMESPACE, DRONE_REPO_NAME, DRONE_BRANCH, DRONE_STAGE_NUMBER ] - volumes: - - name: cache - path: /cache +- name: phpmd + image: joomlaprojects/docker-images:php7.4 + commands: + - vendor/bin/phpmd src text cleancode + - vendor/bin/phpmd src text codesize + - vendor/bin/phpmd src text controversial + - vendor/bin/phpmd src text design + - vendor/bin/phpmd src text unusedcode + failure: ignore - - name: analysis3x - image: rips/rips-cli:3.2.2 - when: - repo: - - joomla/joomla-cms - - joomla/cms-security - branch: - - staging - commands: - - export RIPS_BASE_URI='https://api.rips.joomla.org' - - rips-cli rips:list --table=scans --parameter filter='{"__and":[{"__lessThan":{"percent":100}}]}' - - rips-cli rips:scan:start --progress --application=1 --threshold=0 --path=$(pwd) --remove-code --remove-upload --tag=$DRONE_REPO_NAMESPACE-$DRONE_BRANCH || { echo "Please contact the security team at security@joomla.org"; exit 1; } - environment: - RIPS_EMAIL: - from_secret: RIPS_EMAIL - RIPS_PASSWORD: - from_secret: RIPS_PASSWORD +- name: phpcpd + image: joomlaprojects/docker-images:php7.4 + commands: + - phpcpd src + failure: ignore + +- name: analysis3x + image: rips/rips-cli:3.2.2 + commands: + - export RIPS_BASE_URI='https://api.rips.joomla.org' + - rips-cli rips:list --table=scans --parameter filter='{"__and":[{"__lessThan":{"percent":100}}]}' + - rips-cli rips:scan:start --progress --application=1 --threshold=0 --path=$(pwd) --remove-code --remove-upload --tag=$DRONE_REPO_NAMESPACE-$DRONE_BRANCH || { echo "Please contact the security team at security@joomla.org"; exit 1; } + environment: + RIPS_EMAIL: + from_secret: RIPS_EMAIL + RIPS_PASSWORD: + from_secret: RIPS_PASSWORD + when: + branch: + - staging + repo: + - joomla/joomla-cms + - joomla/cms-security volumes: -- name: cache +- name: composer-cache host: - path: /tmp/cache + path: /tmp/composer-cache -branches: - exclude: [ l10n_* ] +--- +kind: pipeline +name: PHP 5.3 + +platform: + os: linux + arch: amd64 + +steps: +- name: composer + image: joomlaprojects/docker-images:php5.3 + commands: + - php -v + - composer install + volumes: + - name: composer-cache + path: /tmp/composer-cache + +- name: prepare + image: joomlaprojects/docker-images:php5.3 + commands: + - php -v + - sleep 10 + - mysql --host=mysql --user=joomla_ut --password=joomla_ut --database=joomla_ut < "tests/unit/schema/mysql.sql" + - psql -h postgres -d joomla_ut -U joomla_ut -a -f "tests/unit/schema/postgresql.sql" + +- name: PHPUnit + image: joomlaprojects/docker-images:php5.3 + commands: + - libraries/vendor/bin/phpunit + +services: +- name: mysql + image: mysql:5.7 + environment: + MYSQL_DATABASE: joomla_ut + MYSQL_PASSWORD: joomla_ut + MYSQL_ROOT_PASSWORD: joomla_ut + MYSQL_USER: joomla_ut + +- name: postgres + image: postgres:11-alpine + environment: + POSTGRES_DB: joomla_ut + POSTGRES_PASSWORD: joomla_ut + POSTGRES_USER: joomla_ut + ports: + - 5432 + +- name: memcached + image: memcached:alpine + +- name: redis + image: redis:alpine + +volumes: +- name: composer-cache + host: + path: /tmp/composer-cache + +--- +kind: pipeline +name: PHP 5.4 + +platform: + os: linux + arch: amd64 + +steps: +- name: composer + image: joomlaprojects/docker-images:php5.4 + commands: + - php -v + - composer install + volumes: + - name: composer-cache + path: /tmp/composer-cache + +- name: prepare + image: joomlaprojects/docker-images:php5.4 + commands: + - php -v + - sleep 10 + - mysql --host=mysql --user=joomla_ut --password=joomla_ut --database=joomla_ut < "tests/unit/schema/mysql.sql" + - psql -h postgres -d joomla_ut -U joomla_ut -a -f "tests/unit/schema/postgresql.sql" + +- name: PHPUnit + image: joomlaprojects/docker-images:php5.4 + commands: + - libraries/vendor/bin/phpunit + +services: +- name: mysql + image: mysql:5.7 + environment: + MYSQL_DATABASE: joomla_ut + MYSQL_PASSWORD: joomla_ut + MYSQL_ROOT_PASSWORD: joomla_ut + MYSQL_USER: joomla_ut + +- name: postgres + image: postgres:11-alpine + environment: + POSTGRES_DB: joomla_ut + POSTGRES_PASSWORD: joomla_ut + POSTGRES_USER: joomla_ut + ports: + - 5432 + +- name: memcached + image: memcached:alpine + +- name: redis + image: redis:alpine + +volumes: +- name: composer-cache + host: + path: /tmp/composer-cache + +--- +kind: pipeline +name: PHP 5.5 + +platform: + os: linux + arch: amd64 + +steps: +- name: composer + image: joomlaprojects/docker-images:php5.5 + commands: + - php -v + - composer install + volumes: + - name: composer-cache + path: /tmp/composer-cache + +- name: prepare + image: joomlaprojects/docker-images:php5.5 + commands: + - php -v + - sleep 10 + - mysql --host=mysql --user=joomla_ut --password=joomla_ut --database=joomla_ut < "tests/unit/schema/mysql.sql" + - psql -h postgres -d joomla_ut -U joomla_ut -a -f "tests/unit/schema/postgresql.sql" + +- name: PHPUnit + image: joomlaprojects/docker-images:php5.5 + commands: + - libraries/vendor/bin/phpunit + +services: +- name: mysql + image: mysql:5.7 + environment: + MYSQL_DATABASE: joomla_ut + MYSQL_PASSWORD: joomla_ut + MYSQL_ROOT_PASSWORD: joomla_ut + MYSQL_USER: joomla_ut + +- name: postgres + image: postgres:11-alpine + environment: + POSTGRES_DB: joomla_ut + POSTGRES_PASSWORD: joomla_ut + POSTGRES_USER: joomla_ut + ports: + - 5432 + +- name: memcached + image: memcached:alpine + +- name: redis + image: redis:alpine + +volumes: +- name: composer-cache + host: + path: /tmp/composer-cache + +--- +kind: pipeline +name: PHP 5.6 + +platform: + os: linux + arch: amd64 + +steps: +- name: composer + image: joomlaprojects/docker-images:php5.6 + commands: + - php -v + - composer install + volumes: + - name: composer-cache + path: /tmp/composer-cache + +- name: prepare + image: joomlaprojects/docker-images:php5.6 + commands: + - php -v + - sleep 10 + - mysql --host=mysql --user=joomla_ut --password=joomla_ut --database=joomla_ut < "tests/unit/schema/mysql.sql" + - psql -h postgres -d joomla_ut -U joomla_ut -a -f "tests/unit/schema/postgresql.sql" + +- name: PHPUnit + image: joomlaprojects/docker-images:php5.6 + commands: + - libraries/vendor/bin/phpunit + +services: +- name: mysql + image: mysql:5.7 + environment: + MYSQL_DATABASE: joomla_ut + MYSQL_PASSWORD: joomla_ut + MYSQL_ROOT_PASSWORD: joomla_ut + MYSQL_USER: joomla_ut + +- name: postgres + image: postgres:11-alpine + environment: + POSTGRES_DB: joomla_ut + POSTGRES_PASSWORD: joomla_ut + POSTGRES_USER: joomla_ut + ports: + - 5432 + +- name: memcached + image: memcached:alpine + +- name: redis + image: redis:alpine + +volumes: +- name: composer-cache + host: + path: /tmp/composer-cache + +--- +kind: pipeline +name: PHP 7.0 + +platform: + os: linux + arch: amd64 + +steps: +- name: composer + image: joomlaprojects/docker-images:php7.0 + commands: + - php -v + - composer install + volumes: + - name: composer-cache + path: /tmp/composer-cache + +- name: prepare + image: joomlaprojects/docker-images:php7.0 + commands: + - php -v + - sleep 10 + - mysql --host=mysql --user=joomla_ut --password=joomla_ut --database=joomla_ut < "tests/unit/schema/mysql.sql" + - psql -h postgres -d joomla_ut -U joomla_ut -a -f "tests/unit/schema/postgresql.sql" + +- name: PHPUnit + image: joomlaprojects/docker-images:php7.0 + commands: + - libraries/vendor/bin/phpunit + +services: +- name: mysql + image: mysql:5.7 + environment: + MYSQL_DATABASE: joomla_ut + MYSQL_PASSWORD: joomla_ut + MYSQL_ROOT_PASSWORD: joomla_ut + MYSQL_USER: joomla_ut + +- name: postgres + image: postgres:11-alpine + environment: + POSTGRES_DB: joomla_ut + POSTGRES_PASSWORD: joomla_ut + POSTGRES_USER: joomla_ut + ports: + - 5432 + +- name: memcached + image: memcached:alpine + +- name: redis + image: redis:alpine + +volumes: +- name: composer-cache + host: + path: /tmp/composer-cache + +--- +kind: pipeline +name: PHP 7.1 + +platform: + os: linux + arch: amd64 + +steps: +- name: composer + image: joomlaprojects/docker-images:php7.1 + commands: + - php -v + - composer install + volumes: + - name: composer-cache + path: /tmp/composer-cache + +- name: prepare + image: joomlaprojects/docker-images:php7.1 + commands: + - php -v + - sleep 10 + - mysql --host=mysql --user=joomla_ut --password=joomla_ut --database=joomla_ut < "tests/unit/schema/mysql.sql" + - psql -h postgres -d joomla_ut -U joomla_ut -a -f "tests/unit/schema/postgresql.sql" + +- name: PHPUnit + image: joomlaprojects/docker-images:php7.1 + commands: + - libraries/vendor/bin/phpunit + +services: +- name: mysql + image: mysql:5.7 + environment: + MYSQL_DATABASE: joomla_ut + MYSQL_PASSWORD: joomla_ut + MYSQL_ROOT_PASSWORD: joomla_ut + MYSQL_USER: joomla_ut + +- name: postgres + image: postgres:11-alpine + environment: + POSTGRES_DB: joomla_ut + POSTGRES_PASSWORD: joomla_ut + POSTGRES_USER: joomla_ut + ports: + - 5432 + +- name: memcached + image: memcached:alpine + +- name: redis + image: redis:alpine + +volumes: +- name: composer-cache + host: + path: /tmp/composer-cache + +--- +kind: pipeline +name: PHP 7.2 + +platform: + os: linux + arch: amd64 + +steps: +- name: composer + image: joomlaprojects/docker-images:php7.2 + commands: + - php -v + - composer install + volumes: + - name: composer-cache + path: /tmp/composer-cache + +- name: prepare + image: joomlaprojects/docker-images:php7.2 + commands: + - php -v + - sleep 10 + - mysql --host=mysql --user=joomla_ut --password=joomla_ut --database=joomla_ut < "tests/unit/schema/mysql.sql" + - psql -h postgres -d joomla_ut -U joomla_ut -a -f "tests/unit/schema/postgresql.sql" + +- name: PHPUnit + image: joomlaprojects/docker-images:php7.2 + commands: + - libraries/vendor/bin/phpunit + +services: +- name: mysql + image: mysql:5.7 + environment: + MYSQL_DATABASE: joomla_ut + MYSQL_PASSWORD: joomla_ut + MYSQL_ROOT_PASSWORD: joomla_ut + MYSQL_USER: joomla_ut + +- name: postgres + image: postgres:11-alpine + environment: + POSTGRES_DB: joomla_ut + POSTGRES_PASSWORD: joomla_ut + POSTGRES_USER: joomla_ut + ports: + - 5432 + +- name: memcached + image: memcached:alpine + +- name: redis + image: redis:alpine + +volumes: +- name: composer-cache + host: + path: /tmp/composer-cache + +--- +kind: pipeline +name: PHP 7.3 + +platform: + os: linux + arch: amd64 + +steps: +- name: composer + image: joomlaprojects/docker-images:php7.3 + commands: + - php -v + - composer install + volumes: + - name: composer-cache + path: /tmp/composer-cache + +- name: prepare + image: joomlaprojects/docker-images:php7.3 + commands: + - php -v + - sleep 10 + - mysql --host=mysql --user=joomla_ut --password=joomla_ut --database=joomla_ut < "tests/unit/schema/mysql.sql" + - psql -h postgres -d joomla_ut -U joomla_ut -a -f "tests/unit/schema/postgresql.sql" + +- name: PHPUnit + image: joomlaprojects/docker-images:php7.3 + commands: + - libraries/vendor/bin/phpunit + +services: +- name: mysql + image: mysql:5.7 + environment: + MYSQL_DATABASE: joomla_ut + MYSQL_PASSWORD: joomla_ut + MYSQL_ROOT_PASSWORD: joomla_ut + MYSQL_USER: joomla_ut + +- name: postgres + image: postgres:11-alpine + environment: + POSTGRES_DB: joomla_ut + POSTGRES_PASSWORD: joomla_ut + POSTGRES_USER: joomla_ut + ports: + - 5432 + +- name: memcached + image: memcached:alpine + +- name: redis + image: redis:alpine + +volumes: +- name: composer-cache + host: + path: /tmp/composer-cache + +--- +kind: pipeline +name: PHP 7.4 + +platform: + os: linux + arch: amd64 + +steps: +- name: composer + image: joomlaprojects/docker-images:php7.4 + commands: + - php -v + - composer install + volumes: + - name: composer-cache + path: /tmp/composer-cache + +- name: prepare + image: joomlaprojects/docker-images:php7.4 + commands: + - php -v + - sleep 10 + - mysql --host=mysql --user=joomla_ut --password=joomla_ut --database=joomla_ut < "tests/unit/schema/mysql.sql" + - psql -h postgres -d joomla_ut -U joomla_ut -a -f "tests/unit/schema/postgresql.sql" + +- name: PHPUnit + image: joomlaprojects/docker-images:php7.4 + commands: + - libraries/vendor/bin/phpunit + +services: +- name: mysql + image: mysql:5.7 + environment: + MYSQL_DATABASE: joomla_ut + MYSQL_PASSWORD: joomla_ut + MYSQL_ROOT_PASSWORD: joomla_ut + MYSQL_USER: joomla_ut + +- name: postgres + image: postgres:11-alpine + environment: + POSTGRES_DB: joomla_ut + POSTGRES_PASSWORD: joomla_ut + POSTGRES_USER: joomla_ut + ports: + - 5432 + +- name: memcached + image: memcached:alpine + +- name: redis + image: redis:alpine + +volumes: +- name: composer-cache + host: + path: /tmp/composer-cache + +--- +kind: pipeline +name: PHP 8.0 + +platform: + os: linux + arch: amd64 + +steps: +- name: composer + image: joomlaprojects/docker-images:php8.0 + commands: + - php -v + - composer install + volumes: + - name: composer-cache + path: /tmp/composer-cache + +- name: prepare + image: joomlaprojects/docker-images:php8.0 + commands: + - php -v + - sleep 10 + - mysql --host=mysql --user=joomla_ut --password=joomla_ut --database=joomla_ut < "tests/unit/schema/mysql.sql" + - psql -h postgres -d joomla_ut -U joomla_ut -a -f "tests/unit/schema/postgresql.sql" + +- name: PHPUnit + image: joomlaprojects/docker-images:php8.0 + commands: + - libraries/vendor/bin/phpunit + +services: +- name: mysql + image: mysql:5.7 + environment: + MYSQL_DATABASE: joomla_ut + MYSQL_PASSWORD: joomla_ut + MYSQL_ROOT_PASSWORD: joomla_ut + MYSQL_USER: joomla_ut + +- name: postgres + image: postgres:11-alpine + environment: + POSTGRES_DB: joomla_ut + POSTGRES_PASSWORD: joomla_ut + POSTGRES_USER: joomla_ut + ports: + - 5432 + +- name: memcached + image: memcached:alpine + +- name: redis + image: redis:alpine + +volumes: +- name: composer-cache + host: + path: /tmp/composer-cache --- kind: pipeline name: package -steps: - - name: packager - image: joomlaprojects/docker-images:packager - environment: - FTP_USERNAME: - from_secret: ftpusername - FTP_PASSWORD: - from_secret: ftppassword - FTP_HOSTNAME: ci.joomla.org - FTP_PORT: "21" - FTP_DEST_DIR: /artifacts - FTP_VERIFY: "false" - FTP_SECURE: "true" - HTTP_ROOT: "https://ci.joomla.org/artifacts" - DRONE_PULL_REQUEST: DRONE_PULL_REQUEST - DRONE_COMMIT: DRONE_COMMIT - GITHUB_TOKEN: - from_secret: github_token - commands: - - if [ $DRONE_REPO_NAME != 'joomla-cms' ]; then echo "The packager only runs on the joomla/joomla-cms repo"; exit 0; fi - - /bin/drone_build.sh +platform: + os: linux + arch: amd64 +steps: +- name: packager + image: joomlaprojects/docker-images:packager + commands: + - if [ $DRONE_REPO_NAME != 'joomla-cms' ]; then echo "The packager only runs on the joomla/joomla-cms repo"; exit 0; fi + - /bin/drone_build.sh + environment: + DRONE_COMMIT: DRONE_COMMIT + DRONE_PULL_REQUEST: DRONE_PULL_REQUEST + FTP_DEST_DIR: /artifacts + FTP_HOSTNAME: ci.joomla.org + FTP_PASSWORD: + from_secret: ftppassword + FTP_PORT: 21 + FTP_SECURE: true + FTP_USERNAME: + from_secret: ftpusername + FTP_VERIFY: false + GITHUB_TOKEN: + from_secret: github_token + HTTP_ROOT: https://ci.joomla.org/artifacts --- kind: signature -hmac: a825707d539b95fb82da2affd7ba513094430f48cd0d829d38c5f59a6b412d78 +hmac: 0d8cd605edb021ed24ff59cc4a229dcd311ab9b9bbfba5194b3de00cdede60f3 ... diff --git a/.hound.yml b/.hound.yml deleted file mode 100644 index 87a3326e2f9..00000000000 --- a/.hound.yml +++ /dev/null @@ -1,13 +0,0 @@ -fail_on_violations: false - -scss: - enabled: false - -jshint: - enabled: false - -eslint: - enabled: false - -ruby: - enabled: false diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 068ed2c5b04..00000000000 --- a/.travis.yml +++ /dev/null @@ -1,63 +0,0 @@ -# Forces new Travis-CI Infrastructure -sudo: false - -language: php - -env: - global: - - RUN_UNIT_TESTS="yes" - - INSTALL_APCU="yes" - - INSTALL_MEMCACHED="yes" - - INSTALL_REDIS="yes" - -matrix: - fast_finish: true - include: - # Requires older Precise image - - php: 5.3 - env: - - INSTALL_APC="yes" - - INSTALL_APCU="no" - - INSTALL_MEMCACHE="yes" - sudo: true - dist: precise - # The new Trusty image has issues with running APC, do not enable it here - - php: 5.4 - env: - - INSTALL_APCU="no" - - INSTALL_MEMCACHE="yes" - dist: trusty - - php: 5.5 - env: - - INSTALL_MEMCACHE="yes" - dist: trusty - - php: 5.6 - env: - - INSTALL_MEMCACHE="yes" - dist: trusty - - php: 7.0 - - php: 7.1 - - php: 7.2 - - php: 7.3 - - php: 7.4 - - php: nightly - allow_failures: - - php: nightly - -services: - - memcache - - memcached - - redis-server - - mysql - - postgresql - -before_script: - # Make sure all dev dependencies are installed - - if [[ $RUN_UNIT_TESTS == "yes" ]]; then bash build/travis/unit-tests.sh $PWD; fi - -script: - - if [[ $RUN_UNIT_TESTS == "yes" ]]; then libraries/vendor/bin/phpunit --configuration travisci-phpunit.xml; fi - -branches: - except: - - 2.5.x diff --git a/README.md b/README.md index 476e093ecb3..38a4c416975 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ -Joomla! CMS™ [![Analytics](https://ga-beacon.appspot.com/UA-544070-3/joomla-cms/readme)](https://github.com/igrigorik/ga-beacon) [![Reviewed by Hound](https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg)](https://houndci.com) +Joomla! CMS™ [![Analytics](https://ga-beacon.appspot.com/UA-544070-3/joomla-cms/readme)](https://github.com/igrigorik/ga-beacon) ==================== Build Status --------------------- -| Travis-CI | Drone-CI | AppVeyor | -| ------------- | ------------- | ------------- | -| [![Build Status](https://travis-ci.org/joomla/joomla-cms.svg?branch=staging)](https://travis-ci.org/joomla/joomla-cms) | [![Build Status](https://ci.joomla.org/api/badges/joomla/joomla-cms/status.svg)](https://ci.joomla.org/joomla/joomla-cms) | [![Build status](https://ci.appveyor.com/api/projects/status/ru6sxal8jmfckvjc/branch/staging?svg=true)](https://ci.appveyor.com/project/release-joomla/joomla-cms) | +| Drone-CI | AppVeyor | +| ------------- | ------------- | +| [![Build Status](https://ci.joomla.org/api/badges/joomla/joomla-cms/status.svg)](https://ci.joomla.org/joomla/joomla-cms) | [![Build status](https://ci.appveyor.com/api/projects/status/ru6sxal8jmfckvjc/branch/staging?svg=true)](https://ci.appveyor.com/project/release-joomla/joomla-cms) | What is this? --------------------- diff --git a/phpunit.xml.dist b/phpunit.xml.dist index b05b6307863..097d6fe64ba 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,19 +1,18 @@ - - - - - - - + + + + + + - - - + + + - --> diff --git a/tests/unit/suites/libraries/joomla/cache/storage/JCacheStorageMemcachedTest.php b/tests/unit/suites/libraries/joomla/cache/storage/JCacheStorageMemcachedTest.php index 8617baa237d..ce926e982cf 100644 --- a/tests/unit/suites/libraries/joomla/cache/storage/JCacheStorageMemcachedTest.php +++ b/tests/unit/suites/libraries/joomla/cache/storage/JCacheStorageMemcachedTest.php @@ -32,8 +32,7 @@ class JCacheStorageMemcachedTest extends TestCaseCache if ($dsn) { - - // First let's trim the redis: part off the front of the DSN if it exists. + // First let's trim the memcached: part off the front of the DSN if it exists. if (strpos($dsn, 'memcached:') === 0) { $dsn = substr($dsn, 10); @@ -60,6 +59,10 @@ class JCacheStorageMemcachedTest extends TestCaseCache } } } + else + { + $this->markTestSkipped('No configuration for Memcached given'); + } try { @@ -67,7 +70,7 @@ class JCacheStorageMemcachedTest extends TestCaseCache } catch (JCacheExceptionConnecting $e) { - $this->markTestSkipped('Failed to connect to Memcached'); + $this->fail('Failed to connect to Memcached'); } // Override the lifetime because the JCacheStorage API multiplies it by 60 (converts minutes to seconds) diff --git a/tests/unit/suites/libraries/joomla/cache/storage/JCacheStorageRedisTest.php b/tests/unit/suites/libraries/joomla/cache/storage/JCacheStorageRedisTest.php index 9104410f1b1..790a17ce014 100644 --- a/tests/unit/suites/libraries/joomla/cache/storage/JCacheStorageRedisTest.php +++ b/tests/unit/suites/libraries/joomla/cache/storage/JCacheStorageRedisTest.php @@ -27,33 +27,8 @@ class JCacheStorageRedisTest extends TestCaseCache parent::setUp(); - // Mock the returns on JApplicationCms::get() to use the default values - JFactory::$application->expects($this->any()) - ->method('get') - ->will($this->returnCallback(array($this, 'applicationGetterCallback'))); - - $this->handler = new JCacheStorageRedis; - - // This adapter doesn't throw an Exception on a connection failure so we'll have to use Reflection to get into the class to check it - if (!(TestReflection::getValue($this->handler, '_redis') instanceof Redis)) - { - $this->markTestSkipped('Failed to connect to Redis'); - } - - // Override the lifetime because the JCacheStorage API multiplies it by 60 (converts minutes to seconds) - $this->handler->_lifetime = 2; - } - - /** - * Callback for application getter that returns redis credentials - * - * @return mixed - */ - public function applicationGetterCallback() - { // Parse the DSN details for the test server - $dsn = defined('JTEST_CACHE_REDIS_DSN') ? JTEST_CACHE_REDIS_DSN : getenv('JTEST_CACHE_REDIS_DSN'); - $args = func_get_args(); + $dsn = defined('JTEST_CACHE_REDIS_DSN') ? JTEST_CACHE_REDIS_DSN : getenv('JTEST_CACHE_REDIS_DSN'); if ($dsn) { @@ -63,33 +38,48 @@ class JCacheStorageRedisTest extends TestCaseCache $dsn = substr($dsn, 6); } + // Call getConfig once to have the registry object prepared + JFactory::getConfig(); + // Split the DSN into its parts over semicolons. $parts = explode(';', $dsn); - $connection = array(); // Parse each part and populate the options array. foreach ($parts as $part) { list ($k, $v) = explode('=', $part, 2); - $connection[$k] = $v; - } - - switch ($args[0]) - { - case "redis_server_host": - return $connection["host"]; - break; - case "redis_server_port": - return $connection["port"]; - break; - case "redis_server_auth": - return $connection["auth"]; - break; - case "redis_server_db": - return $connection["db"]; - break; + switch ($k) + { + case 'host': + JFactory::$config->set("redis_server_host", $v); + break; + case 'port': + JFactory::$config->set("redis_server_port", $v); + break; + case 'db': + JFactory::$config->set("redis_server_db", $v); + break; + case 'auth': + JFactory::$config->set("redis_server_auth", $v); + break; + } } } - return $args[1]; + else + { + $this->markTestSkipped('No configuration for Redis given'); + } + + try + { + $this->handler = new JCacheStorageRedis; + } + catch (JCacheExceptionConnecting $e) + { + $this->fail('Failed to connect to Redis'); + } + + // Override the lifetime because the JCacheStorage API multiplies it by 60 (converts minutes to seconds) + $this->handler->_lifetime = 2; } } diff --git a/travisci-phpunit.xml b/travisci-phpunit.xml deleted file mode 100644 index 36e0531c59a..00000000000 --- a/travisci-phpunit.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - tests/unit/suites/libraries/cms - - - tests/unit/suites/libraries/joomla - - - tests/unit/suites/libraries/legacy - - - tests/unit/suites/database - - - tests/unit/suites/administrator - - - tests/unit/suites/finderIndexer - - - tests/unit/suites/plugins - - -