mirror of https://github.com/sualko/cloud_bbb
commit
cd7cf3c0ab
|
@ -12,16 +12,12 @@ jobs:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
php-versions: ['7.3', '7.4']
|
php-versions: ['7.3', '7.4']
|
||||||
nextcloud-versions: ['stable19', 'stable20', 'stable21', 'master']
|
nextcloud-versions: ['stable19', 'stable20', 'stable21']
|
||||||
include:
|
include:
|
||||||
- php-versions: '7.2'
|
- php-versions: '7.2'
|
||||||
nextcloud-versions: 'stable19'
|
nextcloud-versions: 'stable19'
|
||||||
- php-versions: '7.2'
|
- php-versions: '7.2'
|
||||||
nextcloud-versions: 'stable20'
|
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
|
name: php${{ matrix.php-versions }} on ${{ matrix.nextcloud-versions }} unit tests
|
||||||
env:
|
env:
|
||||||
CI: true
|
CI: true
|
||||||
|
@ -48,10 +44,12 @@ jobs:
|
||||||
- name: Downgrade phpunit for php7.2
|
- name: Downgrade phpunit for php7.2
|
||||||
if: ${{ matrix.php-versions == '7.2' }}
|
if: ${{ matrix.php-versions == '7.2' }}
|
||||||
working-directory: nextcloud/apps/bbb
|
working-directory: nextcloud/apps/bbb
|
||||||
run: composer update christophwurst/nextcloud_testing -W
|
run: composer update phpunit/phpunit -W
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
working-directory: nextcloud/apps/bbb
|
working-directory: nextcloud/apps/bbb
|
||||||
run: composer install
|
run: composer install
|
||||||
|
- name: Enable app
|
||||||
|
run: php -f nextcloud/occ app:enable bbb
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
working-directory: nextcloud/apps/bbb
|
working-directory: nextcloud/apps/bbb
|
||||||
run: composer run test
|
run: composer run test
|
|
@ -6,7 +6,7 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
ocp-version: [ 'dev-master', 'v20.0.0' ]
|
ocp-version: [ 'dev-stable21', 'dev-stable20', 'dev-stable19' ]
|
||||||
name: Nextcloud ${{ matrix.ocp-version }}
|
name: Nextcloud ${{ matrix.ocp-version }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
|
|
|
@ -40,7 +40,7 @@ Developer wanted! If you have time it would be awesome if you could help to enha
|
||||||
<lib>curl</lib>
|
<lib>curl</lib>
|
||||||
<lib>mbstring</lib>
|
<lib>mbstring</lib>
|
||||||
<lib>SimpleXML</lib>
|
<lib>SimpleXML</lib>
|
||||||
<nextcloud min-version="18" max-version="20"/>
|
<nextcloud min-version="19" max-version="21"/>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<settings>
|
<settings>
|
||||||
<admin>OCA\BigBlueButton\Settings\Admin</admin>
|
<admin>OCA\BigBlueButton\Settings\Admin</admin>
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
"littleredbutton/bigbluebutton-api-php": "^3.0"
|
"littleredbutton/bigbluebutton-api-php": "^3.0"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"phpunit/phpunit": "^8",
|
"phpunit/phpunit": "^8.5 || ^9.3",
|
||||||
"friendsofphp/php-cs-fixer": "^2.16",
|
"friendsofphp/php-cs-fixer": "^2.16",
|
||||||
"nextcloud/coding-standard": "^0.3.0",
|
"nextcloud/coding-standard": "^0.3.0",
|
||||||
"phpstan/phpstan": "^0.12.29",
|
"phpstan/phpstan": "^0.12.29",
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -50,7 +50,8 @@ class Application extends App {
|
||||||
}
|
}
|
||||||
|
|
||||||
private function registerAsPersonalSetting() {
|
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);
|
$settingsManager->registerSetting(ISettingsManager::KEY_PERSONAL_SETTINGS, \OCA\BigBlueButton\Settings\Personal::class);
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,7 +69,7 @@ class RestrictionController extends Controller {
|
||||||
string $groupId
|
string $groupId
|
||||||
): DataResponse {
|
): DataResponse {
|
||||||
if ($this->service->existsByGroupId($groupId)) {
|
if ($this->service->existsByGroupId($groupId)) {
|
||||||
return new DataResponse(null, Http::STATUS_CONFLICT);
|
return new DataResponse([], Http::STATUS_CONFLICT);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new DataResponse($this->service->create(
|
return new DataResponse($this->service->create(
|
||||||
|
|
|
@ -75,22 +75,22 @@ class RoomController extends Controller {
|
||||||
string $access
|
string $access
|
||||||
): DataResponse {
|
): DataResponse {
|
||||||
if (!$this->permission->isAllowedToCreateRoom($this->userId)) {
|
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);
|
$restriction = $this->permission->getRestriction($this->userId);
|
||||||
|
|
||||||
if ($restriction->getMaxParticipants() > -1 && ($maxParticipants > $restriction->getMaxParticipants() || $maxParticipants <= 0)) {
|
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) {
|
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());
|
$disabledRoomTypes = \json_decode($restriction->getRoomTypes());
|
||||||
if (in_array($access, $disabledRoomTypes) || !in_array($access, Room::ACCESS)) {
|
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(
|
return new DataResponse($this->service->create(
|
||||||
|
@ -126,16 +126,16 @@ class RoomController extends Controller {
|
||||||
$restriction = $this->permission->getRestriction($this->userId);
|
$restriction = $this->permission->getRestriction($this->userId);
|
||||||
|
|
||||||
if ($restriction->getMaxParticipants() > -1 && $maxParticipants !== $room->getMaxParticipants() && ($maxParticipants > $restriction->getMaxParticipants() || $maxParticipants <= 0)) {
|
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()) {
|
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());
|
$disabledRoomTypes = \json_decode($restriction->getRoomTypes());
|
||||||
if ((in_array($access, $disabledRoomTypes) && $access !== $room->getAccess()) || !in_array($access, Room::ACCESS)) {
|
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) {
|
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);
|
$room = $this->service->find($id);
|
||||||
|
|
||||||
if (!$this->permission->isAdmin($room, $this->userId)) {
|
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) {
|
return $this->handleNotFound(function () use ($id) {
|
||||||
|
|
|
@ -108,7 +108,7 @@ class RoomShareController extends Controller {
|
||||||
int $permission
|
int $permission
|
||||||
): DataResponse {
|
): DataResponse {
|
||||||
if (!$this->isUserAllowed($roomId)) {
|
if (!$this->isUserAllowed($roomId)) {
|
||||||
return new DataResponse(null, Http::STATUS_FORBIDDEN);
|
return new DataResponse([], Http::STATUS_FORBIDDEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new DataResponse($this->service->create(
|
return new DataResponse($this->service->create(
|
||||||
|
@ -130,7 +130,7 @@ class RoomShareController extends Controller {
|
||||||
int $permission
|
int $permission
|
||||||
): DataResponse {
|
): DataResponse {
|
||||||
if (!$this->isUserAllowed($roomId)) {
|
if (!$this->isUserAllowed($roomId)) {
|
||||||
return new DataResponse(null, Http::STATUS_FORBIDDEN);
|
return new DataResponse([], Http::STATUS_FORBIDDEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->handleNotFound(function () use (
|
return $this->handleNotFound(function () use (
|
||||||
|
@ -157,7 +157,7 @@ class RoomShareController extends Controller {
|
||||||
$roomShare = $this->service->find($id);
|
$roomShare = $this->service->find($id);
|
||||||
|
|
||||||
if (!$this->isUserAllowed($roomShare->getRoomId())) {
|
if (!$this->isUserAllowed($roomShare->getRoomId())) {
|
||||||
return new DataResponse(null, Http::STATUS_FORBIDDEN);
|
return new DataResponse([], Http::STATUS_FORBIDDEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->service->delete($id);
|
return $this->service->delete($id);
|
||||||
|
|
|
@ -57,11 +57,11 @@ class HookMiddleware extends Middleware {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($exception instanceof NotFoundException) {
|
if ($exception instanceof NotFoundException) {
|
||||||
return new JSONResponse(null, Http::STATUS_NOT_FOUND);
|
return new JSONResponse([], Http::STATUS_NOT_FOUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($exception instanceof NoPermissionException) {
|
if ($exception instanceof NoPermissionException) {
|
||||||
return new JSONResponse(null, Http::STATUS_FORBIDDEN);
|
return new JSONResponse([], Http::STATUS_FORBIDDEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
throw $exception;
|
throw $exception;
|
||||||
|
|
|
@ -28,7 +28,6 @@ class Version000000Date20200416124731 extends SimpleMigrationStep {
|
||||||
'notnull' => true,
|
'notnull' => true,
|
||||||
]);
|
]);
|
||||||
$table->addColumn('uid', 'string', [
|
$table->addColumn('uid', 'string', [
|
||||||
'unique' => true,
|
|
||||||
'notnull' => true,
|
'notnull' => true,
|
||||||
'length' => 64
|
'length' => 64
|
||||||
]);
|
]);
|
||||||
|
|
|
@ -31,7 +31,6 @@ class Version000000Date20200826100844 extends SimpleMigrationStep {
|
||||||
'notnull' => true,
|
'notnull' => true,
|
||||||
]);
|
]);
|
||||||
$table->addColumn('group_id', 'string', [
|
$table->addColumn('group_id', 'string', [
|
||||||
'unique' => true,
|
|
||||||
'notnull' => true,
|
'notnull' => true,
|
||||||
'length' => 200,
|
'length' => 200,
|
||||||
]);
|
]);
|
||||||
|
|
|
@ -29,7 +29,6 @@ class Version000000Date20210122164501 extends SimpleMigrationStep {
|
||||||
if (!$table->hasColumn('moderator_token')) {
|
if (!$table->hasColumn('moderator_token')) {
|
||||||
$table->addColumn('moderator_token', 'string', [
|
$table->addColumn('moderator_token', 'string', [
|
||||||
'notnull' => false,
|
'notnull' => false,
|
||||||
'unique' => true,
|
|
||||||
'length' => 64
|
'length' => 64
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
13
phpunit.xml
13
phpunit.xml
|
@ -1,12 +1,13 @@
|
||||||
<phpunit bootstrap="tests/bootstrap.php" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true">
|
<?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>
|
<testsuites>
|
||||||
<testsuite name="unit">
|
<testsuite name="unit">
|
||||||
<directory>tests/Unit</directory>
|
<directory>tests/Unit</directory>
|
||||||
</testsuite>
|
</testsuite>
|
||||||
</testsuites>
|
</testsuites>
|
||||||
<filter>
|
|
||||||
<whitelist processUncoveredFilesFromWhitelist="true">
|
|
||||||
<directory suffix=".php">lib</directory>
|
|
||||||
</whitelist>
|
|
||||||
</filter>
|
|
||||||
</phpunit>
|
</phpunit>
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xmlns="https://getpsalm.org/schema/config"
|
xmlns="https://getpsalm.org/schema/config"
|
||||||
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
|
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
|
||||||
|
errorBaseline="tests/psalm-baseline.xml"
|
||||||
>
|
>
|
||||||
<projectFiles>
|
<projectFiles>
|
||||||
<directory name="lib" />
|
<directory name="lib" />
|
||||||
|
|
|
@ -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>
|
Loading…
Reference in New Issue