diff --git a/tests/acceptance/bootstrap/CollaborationContext.php b/tests/acceptance/bootstrap/CollaborationContext.php index d3487dd96..006430d20 100644 --- a/tests/acceptance/bootstrap/CollaborationContext.php +++ b/tests/acceptance/bootstrap/CollaborationContext.php @@ -24,6 +24,7 @@ use Behat\Behat\Context\Context; use Behat\Behat\Hook\Scope\BeforeScenarioScope; use Behat\Gherkin\Node\TableNode; use GuzzleHttp\Exception\GuzzleException; +use PHPUnit\Framework\Assert; use TestHelpers\HttpRequestHelper; use TestHelpers\WebDavHelper; use TestHelpers\CollaborationHelper; @@ -324,4 +325,34 @@ class CollaborationContext implements Context { ) ); } + + /** + * @Then /^the response (should|should not) contain the following MIME types:$/ + * + * @param string $shouldOrNot + * @param TableNode $table + * + * @return void + * @throws Exception + */ + public function theFollowingMimeTypesShouldExistForUser(string $shouldOrNot, TableNode $table):void { + $rows = $table->getRows(); + $responseArray = $this->featureContext->getJsonDecodedResponse($this->featureContext->getResponse())['mime-types']; + $mimeTypes = \array_column($responseArray, 'mime_type'); + foreach ($rows as $row) { + if ($shouldOrNot === "should not") { + Assert::assertFalse( + \in_array($row[0], $mimeTypes), + "the response should not contain the mimetype $row[0].\nMime Types found in response:\n" + . print_r($mimeTypes, true) + ); + } else { + Assert::assertTrue( + \in_array($row[0], $mimeTypes), + "the response does not contain the mimetype $row[0].\nMime Types found in response:\n" + . print_r($mimeTypes, true) + ); + } + } + } } diff --git a/tests/acceptance/features/apiCollaboration/checkFileInfo.feature b/tests/acceptance/features/apiCollaboration/checkFileInfo.feature index 972fd2c78..477b63c5a 100644 --- a/tests/acceptance/features/apiCollaboration/checkFileInfo.feature +++ b/tests/acceptance/features/apiCollaboration/checkFileInfo.feature @@ -1855,3 +1855,10 @@ Feature: check file info with different wopi apps | Collabora | | FakeOffice | | OnlyOffice | + + @issue-10086 + Scenario: check that '/app/list' doesn't contain 'application/octet-stream' MIME type + When user "Alice" sends HTTP method "GET" to URL "/app/list" + Then the HTTP status code should be "200" + And the response should not contain the following MIME types: + | application/octet-stream |