Test all supported ownCloud/Nextcloud version
Add missing tests for the compatible versions from the README: - ownCloud: 9.1+ - Nextcloud: 9+
This commit is contained in:
parent
0906f19557
commit
9846259394
38
.travis.yml
38
.travis.yml
|
|
@ -4,7 +4,6 @@ php:
|
||||||
- 5.6
|
- 5.6
|
||||||
- 7.0
|
- 7.0
|
||||||
- 7.1
|
- 7.1
|
||||||
- 7.2
|
|
||||||
|
|
||||||
cache:
|
cache:
|
||||||
directories:
|
directories:
|
||||||
|
|
@ -24,43 +23,64 @@ env:
|
||||||
global:
|
global:
|
||||||
- PHP_COVERAGE=FALSE
|
- PHP_COVERAGE=FALSE
|
||||||
matrix:
|
matrix:
|
||||||
|
# Nextcloud 9+
|
||||||
- CORE_TYPE=nextcloud CORE_BRANCH=master DB=sqlite
|
- CORE_TYPE=nextcloud CORE_BRANCH=master DB=sqlite
|
||||||
- CORE_TYPE=nextcloud CORE_BRANCH=stable12 DB=sqlite
|
- CORE_TYPE=nextcloud CORE_BRANCH=stable12 DB=sqlite
|
||||||
- CORE_TYPE=nextcloud CORE_BRANCH=stable11 DB=sqlite
|
- CORE_TYPE=nextcloud CORE_BRANCH=stable11 DB=sqlite
|
||||||
|
- CORE_TYPE=nextcloud CORE_BRANCH=stable10 DB=sqlite
|
||||||
|
- CORE_TYPE=nextcloud CORE_BRANCH=stable9 DB=sqlite
|
||||||
|
|
||||||
- CORE_TYPE=nextcloud CORE_BRANCH=master DB=mysql
|
- CORE_TYPE=nextcloud CORE_BRANCH=master DB=mysql
|
||||||
- CORE_TYPE=nextcloud CORE_BRANCH=stable12 DB=mysql
|
- CORE_TYPE=nextcloud CORE_BRANCH=stable12 DB=mysql
|
||||||
- CORE_TYPE=nextcloud CORE_BRANCH=stable11 DB=mysql
|
- CORE_TYPE=nextcloud CORE_BRANCH=stable11 DB=mysql
|
||||||
|
- CORE_TYPE=nextcloud CORE_BRANCH=stable10 DB=mysql
|
||||||
|
- CORE_TYPE=nextcloud CORE_BRANCH=stable9 DB=mysql
|
||||||
|
|
||||||
- CORE_TYPE=nextcloud CORE_BRANCH=master DB=pgsql
|
- CORE_TYPE=nextcloud CORE_BRANCH=master DB=pgsql
|
||||||
- CORE_TYPE=nextcloud CORE_BRANCH=stable12 DB=pgsql
|
- CORE_TYPE=nextcloud CORE_BRANCH=stable12 DB=pgsql
|
||||||
- CORE_TYPE=nextcloud CORE_BRANCH=stable11 DB=pgsql
|
- CORE_TYPE=nextcloud CORE_BRANCH=stable11 DB=pgsql
|
||||||
|
- CORE_TYPE=nextcloud CORE_BRANCH=stable10 DB=pgsql
|
||||||
|
- CORE_TYPE=nextcloud CORE_BRANCH=stable9 DB=pgsql
|
||||||
|
|
||||||
|
# ownCloud 9.1+
|
||||||
- CORE_TYPE=owncloud CORE_BRANCH=master DB=sqlite
|
- CORE_TYPE=owncloud CORE_BRANCH=master DB=sqlite
|
||||||
- CORE_TYPE=owncloud CORE_BRANCH=stable10 DB=sqlite
|
- CORE_TYPE=owncloud CORE_BRANCH=stable10 DB=sqlite
|
||||||
|
- CORE_TYPE=owncloud CORE_BRANCH=stable9.1 DB=sqlite
|
||||||
|
|
||||||
- CORE_TYPE=owncloud CORE_BRANCH=master DB=mysql
|
- CORE_TYPE=owncloud CORE_BRANCH=master DB=mysql
|
||||||
- CORE_TYPE=owncloud CORE_BRANCH=stable10 DB=mysql
|
- CORE_TYPE=owncloud CORE_BRANCH=stable10 DB=mysql
|
||||||
|
- CORE_TYPE=owncloud CORE_BRANCH=stable9.1 DB=mysql
|
||||||
|
|
||||||
- CORE_TYPE=owncloud CORE_BRANCH=master DB=pgsql
|
- CORE_TYPE=owncloud CORE_BRANCH=master DB=pgsql
|
||||||
- CORE_TYPE=owncloud CORE_BRANCH=stable10 DB=pgsql
|
- CORE_TYPE=owncloud CORE_BRANCH=stable10 DB=pgsql
|
||||||
|
- CORE_TYPE=owncloud CORE_BRANCH=stable9.1 DB=pgsql
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
fast_finish: true
|
fast_finish: true
|
||||||
exclude:
|
include:
|
||||||
# Nextcloud 11/12 are not compatible with PHP 7.2
|
# Nextcloud prior v13 is not compatible with PHP 7.2
|
||||||
|
# (see https://github.com/nextcloud/server/issues/6786#issuecomment-335154372)
|
||||||
- php: 7.2
|
- php: 7.2
|
||||||
env: CORE_TYPE=nextcloud CORE_BRANCH=stable11 DB=mysql
|
env: CORE_TYPE=nextcloud CORE_BRANCH=master DB=sqlite
|
||||||
- php: 7.2
|
- php: 7.2
|
||||||
env: CORE_TYPE=nextcloud CORE_BRANCH=stable12 DB=mysql
|
env: CORE_TYPE=nextcloud CORE_BRANCH=master DB=mysql
|
||||||
- php: 7.2
|
- php: 7.2
|
||||||
env: CORE_TYPE=nextcloud CORE_BRANCH=stable11 DB=sqlite
|
env: CORE_TYPE=nextcloud CORE_BRANCH=master DB=pgsql
|
||||||
|
|
||||||
|
# ownCloud prior v10 is not compatible with PHP 7.2
|
||||||
|
# (see https://github.com/owncloud/core/pull/29878)
|
||||||
- php: 7.2
|
- php: 7.2
|
||||||
env: CORE_TYPE=nextcloud CORE_BRANCH=stable12 DB=sqlite
|
env: CORE_TYPE=owncloud CORE_BRANCH=master DB=sqlite
|
||||||
- php: 7.2
|
- php: 7.2
|
||||||
env: CORE_TYPE=nextcloud CORE_BRANCH=stable11 DB=pgsql
|
env: CORE_TYPE=owncloud CORE_BRANCH=master DB=mysql
|
||||||
- php: 7.2
|
- php: 7.2
|
||||||
env: CORE_TYPE=nextcloud CORE_BRANCH=stable12 DB=pgsql
|
env: CORE_TYPE=owncloud CORE_BRANCH=master DB=pgsql
|
||||||
|
- php: 7.2
|
||||||
|
env: CORE_TYPE=owncloud CORE_BRANCH=stable10 DB=sqlite
|
||||||
|
- php: 7.2
|
||||||
|
env: CORE_TYPE=owncloud CORE_BRANCH=stable10 DB=mysql
|
||||||
|
- php: 7.2
|
||||||
|
env: CORE_TYPE=owncloud CORE_BRANCH=stable10 DB=pgsql
|
||||||
|
|
||||||
before_install:
|
before_install:
|
||||||
# XDebug is only needed if we report coverage -> speeds up other builds
|
# XDebug is only needed if we report coverage -> speeds up other builds
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ Flow:
|
||||||
1. ownCloud 9.1.0.7+
|
1. ownCloud 9.1.0.7+
|
||||||
2. Nextcloud 9+
|
2. Nextcloud 9+
|
||||||
|
|
||||||
Supports SQLite and MariaDB, PostgreSQL support is [enabled but not tested](https://github.com/pellaeon/registration/issues/24#issuecomment-294504028).
|
Supports SQLite, MySQL/MariaDB and PostgreSQL.
|
||||||
|
|
||||||
# Install
|
# Install
|
||||||
1. Place this app in `owncloud/apps/` or `nextcloud/apps`
|
1. Place this app in `owncloud/apps/` or `nextcloud/apps`
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,9 @@ namespace OCA\Registration\Util;
|
||||||
class CoreBridge
|
class CoreBridge
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
* This function maps an exception class to the available exception class of the core
|
||||||
|
* in order to provide cross-core and cross-version compatibility.
|
||||||
|
*
|
||||||
* @param string $className
|
* @param string $className
|
||||||
* @return string
|
* @return string
|
||||||
* @throws \LogicException
|
* @throws \LogicException
|
||||||
|
|
@ -13,20 +16,20 @@ class CoreBridge
|
||||||
{
|
{
|
||||||
static $classes = [
|
static $classes = [
|
||||||
'OCSException' => [
|
'OCSException' => [
|
||||||
'nextcloud' => 'OCP\AppFramework\OCS\OCSException',
|
'OCP\AppFramework\OCS\OCSException',
|
||||||
'owncloud' => 'OC\OCS\Exception',
|
'OC\OCS\Exception',
|
||||||
],
|
],
|
||||||
'OCSBadRequestException' => [
|
'OCSBadRequestException' => [
|
||||||
'nextcloud' => 'OCP\AppFramework\OCS\OCSBadRequestException',
|
'OCP\AppFramework\OCS\OCSBadRequestException',
|
||||||
'owncloud' => 'OC\OCS\Exception',
|
'OC\OCS\Exception',
|
||||||
],
|
],
|
||||||
'OCSNotFoundException' => [
|
'OCSNotFoundException' => [
|
||||||
'nextcloud' => 'OCP\AppFramework\OCS\OCSNotFoundException',
|
'OCP\AppFramework\OCS\OCSNotFoundException',
|
||||||
'owncloud' => 'OC\OCS\Exception',
|
'OC\OCS\Exception',
|
||||||
],
|
],
|
||||||
'DoesNotExistException' => [
|
'DoesNotExistException' => [
|
||||||
'nextcloud' => 'OCP\AppFramework\Db\DoesNotExistException',
|
'OCP\AppFramework\Db\DoesNotExistException',
|
||||||
'owncloud' => 'OCP\AppFramework\Db\DoesNotExistException',
|
'OCP\AppFramework\Db\DoesNotExistException',
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
@ -56,8 +59,9 @@ class CoreBridge
|
||||||
$reflection = new \ReflectionClass($exceptionClassName);
|
$reflection = new \ReflectionClass($exceptionClassName);
|
||||||
$params = $reflection->getConstructor()->getParameters();
|
$params = $reflection->getConstructor()->getParameters();
|
||||||
|
|
||||||
if ($params[0]->getClass() && $params[0]->getClass()->getName() === 'OC\OCS\Result') {
|
if ($params[0]->getClass() && ($params[0]->getClass()->getName() === 'OC\OCS\Result' || $params[0]->getClass()->getName() === 'OC_OCS_Result')) {
|
||||||
return new $exceptionClassName(new \OC\OCS\Result($message, $code));
|
$subClass = $params[0]->getClass()->getName();
|
||||||
|
return new $exceptionClassName(new $subClass($message, $code));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($params) >= 2) {
|
if (count($params) >= 2) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue