Merge pull request #126 from sualko/feat-github-actions

Move to github actions
pull/129/head
Klaus 2021-02-13 18:46:53 +01:00 committed by GitHub
commit cd7cf3c0ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 1182 additions and 653 deletions

View File

@ -12,16 +12,12 @@ jobs:
strategy:
matrix:
php-versions: ['7.3', '7.4']
nextcloud-versions: ['stable19', 'stable20', 'stable21', 'master']
nextcloud-versions: ['stable19', 'stable20', 'stable21']
include:
- php-versions: '7.2'
nextcloud-versions: 'stable19'
- php-versions: '7.2'
nextcloud-versions: 'stable20'
- php-versions: '8.0'
nextcloud-versions: 'stable21'
- php-versions: '8.0'
nextcloud-versions: 'master'
name: php${{ matrix.php-versions }} on ${{ matrix.nextcloud-versions }} unit tests
env:
CI: true
@ -48,10 +44,12 @@ jobs:
- name: Downgrade phpunit for php7.2
if: ${{ matrix.php-versions == '7.2' }}
working-directory: nextcloud/apps/bbb
run: composer update christophwurst/nextcloud_testing -W
run: composer update phpunit/phpunit -W
- name: Install dependencies
working-directory: nextcloud/apps/bbb
run: composer install
- name: Enable app
run: php -f nextcloud/occ app:enable bbb
- name: Run tests
working-directory: nextcloud/apps/bbb
run: composer run test

View File

@ -6,7 +6,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
ocp-version: [ 'dev-master', 'v20.0.0' ]
ocp-version: [ 'dev-stable21', 'dev-stable20', 'dev-stable19' ]
name: Nextcloud ${{ matrix.ocp-version }}
steps:
- name: Checkout

View File

@ -40,7 +40,7 @@ Developer wanted! If you have time it would be awesome if you could help to enha
<lib>curl</lib>
<lib>mbstring</lib>
<lib>SimpleXML</lib>
<nextcloud min-version="18" max-version="20"/>
<nextcloud min-version="19" max-version="21"/>
</dependencies>
<settings>
<admin>OCA\BigBlueButton\Settings\Admin</admin>

View File

@ -13,7 +13,7 @@
"littleredbutton/bigbluebutton-api-php": "^3.0"
},
"require-dev": {
"phpunit/phpunit": "^8",
"phpunit/phpunit": "^8.5 || ^9.3",
"friendsofphp/php-cs-fixer": "^2.16",
"nextcloud/coding-standard": "^0.3.0",
"phpstan/phpstan": "^0.12.29",

1712
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -50,7 +50,8 @@ class Application extends App {
}
private function registerAsPersonalSetting() {
$settingsManager = $this->getContainer()->getServer()->getSettingsManager();
/** @var ISettingsManager */
$settingsManager = $this->getContainer()->query(ISettingsManager::class);
$settingsManager->registerSetting(ISettingsManager::KEY_PERSONAL_SETTINGS, \OCA\BigBlueButton\Settings\Personal::class);
}

View File

@ -69,7 +69,7 @@ class RestrictionController extends Controller {
string $groupId
): DataResponse {
if ($this->service->existsByGroupId($groupId)) {
return new DataResponse(null, Http::STATUS_CONFLICT);
return new DataResponse([], Http::STATUS_CONFLICT);
}
return new DataResponse($this->service->create(

View File

@ -75,22 +75,22 @@ class RoomController extends Controller {
string $access
): DataResponse {
if (!$this->permission->isAllowedToCreateRoom($this->userId)) {
return new DataResponse(null, Http::STATUS_FORBIDDEN);
return new DataResponse([], Http::STATUS_FORBIDDEN);
}
$restriction = $this->permission->getRestriction($this->userId);
if ($restriction->getMaxParticipants() > -1 && ($maxParticipants > $restriction->getMaxParticipants() || $maxParticipants <= 0)) {
return new DataResponse('Max participants limit exceeded.', Http::STATUS_BAD_REQUEST);
return new DataResponse(['message' => 'Max participants limit exceeded.'], Http::STATUS_BAD_REQUEST);
}
if (!$restriction->getAllowRecording() && $record) {
return new DataResponse('Not allowed to enable recordings.', Http::STATUS_BAD_REQUEST);
return new DataResponse(['message' => 'Not allowed to enable recordings.'], Http::STATUS_BAD_REQUEST);
}
$disabledRoomTypes = \json_decode($restriction->getRoomTypes());
if (in_array($access, $disabledRoomTypes) || !in_array($access, Room::ACCESS)) {
return new DataResponse('Access type not allowed.', Http::STATUS_BAD_REQUEST);
return new DataResponse(['message' => 'Access type not allowed.'], Http::STATUS_BAD_REQUEST);
}
return new DataResponse($this->service->create(
@ -126,16 +126,16 @@ class RoomController extends Controller {
$restriction = $this->permission->getRestriction($this->userId);
if ($restriction->getMaxParticipants() > -1 && $maxParticipants !== $room->getMaxParticipants() && ($maxParticipants > $restriction->getMaxParticipants() || $maxParticipants <= 0)) {
return new DataResponse('Max participants limit exceeded.', Http::STATUS_BAD_REQUEST);
return new DataResponse(['message' => 'Max participants limit exceeded.'], Http::STATUS_BAD_REQUEST);
}
if (!$restriction->getAllowRecording() && $record !== $room->getRecord()) {
return new DataResponse('Not allowed to enable recordings.', Http::STATUS_BAD_REQUEST);
return new DataResponse(['message' => 'Not allowed to enable recordings.'], Http::STATUS_BAD_REQUEST);
}
$disabledRoomTypes = \json_decode($restriction->getRoomTypes());
if ((in_array($access, $disabledRoomTypes) && $access !== $room->getAccess()) || !in_array($access, Room::ACCESS)) {
return new DataResponse('Access type not allowed.', Http::STATUS_BAD_REQUEST);
return new DataResponse(['message' => 'Access type not allowed.'], Http::STATUS_BAD_REQUEST);
}
return $this->handleNotFound(function () use ($id, $name, $welcome, $maxParticipants, $record, $access, $everyoneIsModerator, $requireModerator, $moderatorToken) {
@ -150,7 +150,7 @@ class RoomController extends Controller {
$room = $this->service->find($id);
if (!$this->permission->isAdmin($room, $this->userId)) {
return new DataResponse(null, Http::STATUS_FORBIDDEN);
return new DataResponse([], Http::STATUS_FORBIDDEN);
}
return $this->handleNotFound(function () use ($id) {

View File

@ -108,7 +108,7 @@ class RoomShareController extends Controller {
int $permission
): DataResponse {
if (!$this->isUserAllowed($roomId)) {
return new DataResponse(null, Http::STATUS_FORBIDDEN);
return new DataResponse([], Http::STATUS_FORBIDDEN);
}
return new DataResponse($this->service->create(
@ -130,7 +130,7 @@ class RoomShareController extends Controller {
int $permission
): DataResponse {
if (!$this->isUserAllowed($roomId)) {
return new DataResponse(null, Http::STATUS_FORBIDDEN);
return new DataResponse([], Http::STATUS_FORBIDDEN);
}
return $this->handleNotFound(function () use (
@ -157,7 +157,7 @@ class RoomShareController extends Controller {
$roomShare = $this->service->find($id);
if (!$this->isUserAllowed($roomShare->getRoomId())) {
return new DataResponse(null, Http::STATUS_FORBIDDEN);
return new DataResponse([], Http::STATUS_FORBIDDEN);
}
return $this->service->delete($id);

View File

@ -57,11 +57,11 @@ class HookMiddleware extends Middleware {
}
if ($exception instanceof NotFoundException) {
return new JSONResponse(null, Http::STATUS_NOT_FOUND);
return new JSONResponse([], Http::STATUS_NOT_FOUND);
}
if ($exception instanceof NoPermissionException) {
return new JSONResponse(null, Http::STATUS_FORBIDDEN);
return new JSONResponse([], Http::STATUS_FORBIDDEN);
}
throw $exception;

View File

@ -28,7 +28,6 @@ class Version000000Date20200416124731 extends SimpleMigrationStep {
'notnull' => true,
]);
$table->addColumn('uid', 'string', [
'unique' => true,
'notnull' => true,
'length' => 64
]);

View File

@ -31,7 +31,6 @@ class Version000000Date20200826100844 extends SimpleMigrationStep {
'notnull' => true,
]);
$table->addColumn('group_id', 'string', [
'unique' => true,
'notnull' => true,
'length' => 200,
]);

View File

@ -29,7 +29,6 @@ class Version000000Date20210122164501 extends SimpleMigrationStep {
if (!$table->hasColumn('moderator_token')) {
$table->addColumn('moderator_token', 'string', [
'notnull' => false,
'unique' => true,
'length' => 64
]);
}

View File

@ -1,12 +1,13 @@
<phpunit bootstrap="tests/bootstrap.php" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true">
<testsuites>
<testsuite name="unit">
<directory>tests/Unit</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">lib</directory>
</whitelist>
</filter>
<?xml version="1.0"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="tests/bootstrap.php" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">lib</directory>
</include>
</coverage>
<testsuites>
<testsuite name="unit">
<directory>tests/Unit</directory>
</testsuite>
</testsuites>
</phpunit>

View File

@ -6,6 +6,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
errorBaseline="tests/psalm-baseline.xml"
>
<projectFiles>
<directory name="lib" />

49
tests/psalm-baseline.xml Normal file
View File

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="4.5.1@257a1ca672a79dedc852be1285a7b97154646418">
<file src="lib/CircleHelper.php">
<UndefinedClass occurrences="3">
<code>\OCA\Circles\Api\v1\Circles</code>
<code>\OCA\Circles\Model\Circle</code>
<code>\OCA\Circles\Model\Member</code>
</UndefinedClass>
</file>
<file src="lib/Controller/RoomController.php">
<NullArgument occurrences="1">
<code>null</code>
</NullArgument>
</file>
<file src="lib/Controller/ServerController.php">
<InvalidArgument occurrences="1">
<code>$success</code>
</InvalidArgument>
</file>
<file src="lib/NoPermissionResponse.php">
<MissingDependency occurrences="1">
<code>Template</code>
</MissingDependency>
</file>
<file src="lib/NotFoundResponse.php">
<MissingDependency occurrences="1">
<code>Template</code>
</MissingDependency>
</file>
<file src="lib/Service/RestrictionService.php">
<InvalidReturnType occurrences="3">
<code>Restriction</code>
<code>Restriction</code>
<code>Restriction</code>
</InvalidReturnType>
</file>
<file src="lib/Service/RoomService.php">
<InvalidReturnType occurrences="1">
<code>Room</code>
</InvalidReturnType>
</file>
<file src="lib/Service/RoomShareService.php">
<InvalidReturnType occurrences="3">
<code>RoomShare</code>
<code>RoomShare</code>
<code>RoomShare</code>
</InvalidReturnType>
</file>
</files>