diff options
Diffstat (limited to 'build')
-rw-r--r-- | build/files-checker.php | 1 | ||||
-rw-r--r-- | build/integration/dav_features/dav-v2.feature | 56 | ||||
-rw-r--r-- | build/integration/dav_features/webdav-related.feature | 20 | ||||
-rw-r--r-- | build/integration/features/bootstrap/Activity.php | 32 | ||||
-rw-r--r-- | build/integration/features/bootstrap/BasicStructure.php | 4 | ||||
-rw-r--r-- | build/integration/features/bootstrap/SharingContext.php | 1 | ||||
-rw-r--r-- | build/integration/sharing_features/sharing-activity.feature | 46 | ||||
-rwxr-xr-x | build/openapi-checker.sh | 15 | ||||
-rw-r--r-- | build/psalm-baseline-ocp.xml | 11 |
9 files changed, 134 insertions, 52 deletions
diff --git a/build/files-checker.php b/build/files-checker.php index 37f58650025..58a97848cec 100644 --- a/build/files-checker.php +++ b/build/files-checker.php @@ -69,6 +69,7 @@ $expectedFiles = [ 'occ', 'ocs', 'ocs-provider', + 'openapi.json', 'package-lock.json', 'package.json', 'psalm-ncu.xml', diff --git a/build/integration/dav_features/dav-v2.feature b/build/integration/dav_features/dav-v2.feature index 2c74030c462..a9e62c8ac9e 100644 --- a/build/integration/dav_features/dav-v2.feature +++ b/build/integration/dav_features/dav-v2.feature @@ -12,15 +12,15 @@ Feature: dav-v2 When User "user0" moves file "/textfile0.txt" to "/FOLDER/textfile0.txt" Then the HTTP status code should be "201" - Scenario: Moving and overwriting it's parent - Given using new dav path - And As an "admin" - And user "user0" exists - And As an "user0" - And user "user0" created a folder "/test" - And user "user0" created a folder "/test/test" - When User "user0" moves file "/test/test" to "/test" - Then the HTTP status code should be "403" + Scenario: Moving and overwriting it's parent + Given using new dav path + And As an "admin" + And user "user0" exists + And As an "user0" + And user "user0" created a folder "/test" + And user "user0" created a folder "/test/test" + When User "user0" moves file "/test/test" to "/test" + Then the HTTP status code should be "403" Scenario: download a file with range using new endpoint Given using new dav path @@ -103,7 +103,7 @@ Feature: dav-v2 | shareType | 0 | | permissions | 31 | | shareWith | user0 | - And user "user0" accepts last share + And user "user0" accepts last share And As an "user0" When User "user0" uploads file "data/textfile.txt" to "/testquota/asdf.txt" Then the HTTP status code should be "201" @@ -111,24 +111,24 @@ Feature: dav-v2 Scenario: Create a search query on image Given using new dav path And As an "admin" - And user "user0" exists - And As an "user0" - When User "user0" uploads file "data/textfile.txt" to "/testquota/asdf.txt" - Then Image search should work - And the response should be empty - When User "user0" uploads file "data/green-square-256.png" to "/image.png" + And user "user0" exists + And As an "user0" + When User "user0" uploads file "data/textfile.txt" to "/testquota/asdf.txt" + Then Image search should work + And the response should be empty + When User "user0" uploads file "data/green-square-256.png" to "/image.png" Then Image search should work - And the single response should contain a property "{DAV:}getcontenttype" with value "image/png" + And the single response should contain a property "{DAV:}getcontenttype" with value "image/png" - Scenario: Create a search query on favorite - Given using new dav path - And As an "admin" - And user "user0" exists - And As an "user0" - When User "user0" uploads file "data/green-square-256.png" to "/fav_image.png" - Then Favorite search should work - And the response should be empty - When user "user0" favorites element "/fav_image.png" - Then Favorite search should work - And the single response should contain a property "{http://owncloud.org/ns}favorite" with value "1" + Scenario: Create a search query on favorite + Given using new dav path + And As an "admin" + And user "user0" exists + And As an "user0" + When User "user0" uploads file "data/green-square-256.png" to "/fav_image.png" + Then Favorite search should work + And the response should be empty + When user "user0" favorites element "/fav_image.png" + Then Favorite search should work + And the single response should contain a property "{http://owncloud.org/ns}favorite" with value "1" diff --git a/build/integration/dav_features/webdav-related.feature b/build/integration/dav_features/webdav-related.feature index 4c8340c1b03..f439330838c 100644 --- a/build/integration/dav_features/webdav-related.feature +++ b/build/integration/dav_features/webdav-related.feature @@ -38,15 +38,15 @@ Feature: webdav-related Then the HTTP status code should be "204" And Downloaded content when downloading file "/textfile0.txt" with range "bytes=0-6" should be "Welcome" - Scenario: Moving and overwriting it's parent - Given using old dav path - And As an "admin" - And user "user0" exists - And As an "user0" - And user "user0" created a folder "/test" - And user "user0" created a folder "/test/test" - When User "user0" moves file "/test/test" to "/test" - Then the HTTP status code should be "403" + Scenario: Moving and overwriting it's parent + Given using old dav path + And As an "admin" + And user "user0" exists + And As an "user0" + And user "user0" created a folder "/test" + And user "user0" created a folder "/test/test" + When User "user0" moves file "/test/test" to "/test" + Then the HTTP status code should be "403" Scenario: Moving a file from shared folder to root folder Given using old dav path @@ -706,7 +706,7 @@ Feature: webdav-related And user "user0" uploads new chunk v2 file "2" to id "chunking-random" And user "user0" uploads new chunk v2 file "4" to id "chunking-random" And user "user0" moves new chunk v2 file with id "chunking-random" - Then the upload should fail on object storage + Then the upload should fail on object storage @s3-multipart Scenario: Upload chunked file with special characters with new chunking v2 diff --git a/build/integration/features/bootstrap/Activity.php b/build/integration/features/bootstrap/Activity.php new file mode 100644 index 00000000000..4172776304d --- /dev/null +++ b/build/integration/features/bootstrap/Activity.php @@ -0,0 +1,32 @@ +<?php + +declare(strict_types=1); + +/** + * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + +use Behat\Gherkin\Node\TableNode; +use PHPUnit\Framework\Assert; + +trait Activity { + use BasicStructure; + + /** + * @Then last activity should be + * @param TableNode $activity + */ + public function lastActivityIs(TableNode $activity): void { + $this->sendRequestForJSON('GET', '/apps/activity/api/v2/activity'); + $this->theHTTPStatusCodeShouldBe('200'); + $data = json_decode($this->response->getBody()->getContents(), true); + $activities = $data['ocs']['data']; + /* Sort by id */ + uasort($activities, fn ($a, $b) => $a['activity_id'] <=> $b['activity_id']); + $lastActivity = array_pop($activities); + foreach ($activity->getRowsHash() as $key => $value) { + Assert::assertEquals($value, $lastActivity[$key]); + } + } +} diff --git a/build/integration/features/bootstrap/BasicStructure.php b/build/integration/features/bootstrap/BasicStructure.php index 57d18757212..a8c232d6fe7 100644 --- a/build/integration/features/bootstrap/BasicStructure.php +++ b/build/integration/features/bootstrap/BasicStructure.php @@ -192,8 +192,8 @@ trait BasicStructure { $options = []; if ($this->currentUser === 'admin') { $options['auth'] = ['admin', 'admin']; - } elseif (strpos($this->currentUser, 'guest') !== 0) { - $options['auth'] = [$this->currentUser, self::TEST_PASSWORD]; + } elseif (strpos($this->currentUser, 'anonymous') !== 0) { + $options['auth'] = [$this->currentUser, $this->regularUser]; } if ($body instanceof TableNode) { $fd = $body->getRowsHash(); diff --git a/build/integration/features/bootstrap/SharingContext.php b/build/integration/features/bootstrap/SharingContext.php index d2f1a2446ae..8ef617adbfb 100644 --- a/build/integration/features/bootstrap/SharingContext.php +++ b/build/integration/features/bootstrap/SharingContext.php @@ -17,6 +17,7 @@ class SharingContext implements Context, SnippetAcceptingContext { use Trashbin; use AppConfiguration; use CommandLine; + use Activity; protected function resetAppConfigs() { $this->deleteServerConfig('core', 'shareapi_default_permissions'); diff --git a/build/integration/sharing_features/sharing-activity.feature b/build/integration/sharing_features/sharing-activity.feature new file mode 100644 index 00000000000..016b376488b --- /dev/null +++ b/build/integration/sharing_features/sharing-activity.feature @@ -0,0 +1,46 @@ +# SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors +# SPDX-License-Identifier: AGPL-3.0-or-later +Feature: sharing + Background: + Given using api version "1" + Given using new dav path + Given invoking occ with "app:enable --force activity" + Given the command was successful + Given user "user0" exists + And Logging in using web as "user0" + And Sending a "POST" to "/apps/activity/settings" with requesttoken + | public_links_notification | 1 | + | public_links_upload_notification | 1 | + | notify_setting_batchtime | 0 | + | activity_digest | 0 | + + Scenario: Creating a new mail share and check activity + Given dummy mail server is listening + And As an "user0" + When creating a share with + | path | welcome.txt | + | shareType | 4 | + | shareWith | dumy@test.com | + Then the OCS status code should be "100" + And the HTTP status code should be "200" + And last share can be downloaded + Then last activity should be + | app | files_sharing | + | type | public_links | + | object_type | files | + | object_name | /welcome.txt | + + Scenario: Creating a new public share and check activity + Given user "user0" exists + And As an "user0" + When creating a share with + | path | welcome.txt | + | shareType | 3 | + Then the OCS status code should be "100" + And the HTTP status code should be "200" + And last link share can be downloaded + Then last activity should be + | app | files_sharing | + | type | public_links | + | object_type | files | + | object_name | /welcome.txt | diff --git a/build/openapi-checker.sh b/build/openapi-checker.sh index 5ad6e619ec3..9e4a4802b25 100755 --- a/build/openapi-checker.sh +++ b/build/openapi-checker.sh @@ -3,13 +3,26 @@ # SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors # SPDX-License-Identifier: AGPL-3.0-or-later +specs=() for path in core apps/*; do if [ ! -f "$path/.noopenapi" ] && [[ "$(git check-ignore "$path")" != "$path" ]]; then composer exec generate-spec "$path" "$path/openapi.json" || exit 1 + if [[ "$(basename "$path")" != "core" ]]; then + if [ -f "$path/openapi-full.json" ]; then + specs+=("$path/openapi-full.json") + else + specs+=("$path/openapi.json") + fi; + fi; fi done -files="$(git diff --name-only)" +composer exec merge-specs -- \ + --core core/openapi-full.json \ + --merged openapi.json \ + "${specs[@]}" + +files="$(git ls-files --exclude-standard --modified --others)" changed=false for file in $files; do if [[ $file == *"openapi"*".json" ]]; then diff --git a/build/psalm-baseline-ocp.xml b/build/psalm-baseline-ocp.xml index ce406cfde75..ed932f8d487 100644 --- a/build/psalm-baseline-ocp.xml +++ b/build/psalm-baseline-ocp.xml @@ -53,17 +53,6 @@ <code><![CDATA[\Iterator]]></code> </MissingTemplateParam> </file> - <file src="lib/public/Template.php"> - <UndefinedFunction> - <code><![CDATA[\html_select_options($options, $selected, $params)]]></code> - <code><![CDATA[\human_file_size($bytes)]]></code> - <code><![CDATA[\image_path($app, $image)]]></code> - <code><![CDATA[\mimetype_icon($mimetype)]]></code> - <code><![CDATA[\preview_icon($path)]]></code> - <code><![CDATA[\publicPreview_icon($path, $token)]]></code> - <code><![CDATA[\relative_modified_date($timestamp, null, $dateOnly)]]></code> - </UndefinedFunction> - </file> <file src="lib/public/Util.php"> <UndefinedClass> <code><![CDATA[\OC]]></code> |