diff options
-rw-r--r-- | tests/_support/Helper/DataSetup.php | 5 | ||||
-rw-r--r-- | tests/api/GetThumbnailsCest.php | 6 | ||||
-rw-r--r-- | utility/eventsource.php | 2 |
3 files changed, 7 insertions, 6 deletions
diff --git a/tests/_support/Helper/DataSetup.php b/tests/_support/Helper/DataSetup.php index 35c1c1cd..7e2cc8a1 100644 --- a/tests/_support/Helper/DataSetup.php +++ b/tests/_support/Helper/DataSetup.php @@ -178,11 +178,12 @@ class DataSetup extends \Codeception\Module { foreach ($content as $node) { $nodeType = $node->getType(); - if ($nodeType === 'file') { + $mimeType = $node->getMimetype(); + if ($nodeType === 'file' && in_array($mimeType, $this->mediaTypes)) { $data[] = [ 'id' => $node->getId(), 'name' => $node->getName(), - 'mediatype' => $node->getMimetype(), + 'mediatype' => $mimeType, 'etag' => $node->getEtag(), ]; } diff --git a/tests/api/GetThumbnailsCest.php b/tests/api/GetThumbnailsCest.php index f81e647a..8ffccb21 100644 --- a/tests/api/GetThumbnailsCest.php +++ b/tests/api/GetThumbnailsCest.php @@ -69,12 +69,12 @@ class GetThumbnailsCest { $I->wantTo('receive 404 events when I send the wrong IDs'); $I->getUserCredentialsAndUseHttpAuthentication(); $I->haveHttpHeader('Accept', 'text/event-stream'); - $this->params['ids'] = '0;1'; + $this->params['ids'] = '99998;99999'; $I->sendGET($this->apiUrl, $this->params); $I->seeResponseCodeIs(200); $I->seeHttpHeader('Content-type', 'text/event-stream;charset=UTF-8'); - $I->seeResponseContains('"fileid":"0","status":404'); - $I->seeResponseContains('"fileid":"1","status":404'); + $I->seeResponseContains('"fileid":"99998","status":404'); + $I->seeResponseContains('"fileid":"99999","status":404'); } } diff --git a/utility/eventsource.php b/utility/eventsource.php index 63bf1d72..d874ae7e 100644 --- a/utility/eventsource.php +++ b/utility/eventsource.php @@ -73,7 +73,7 @@ class EventSource implements \OCP\IEventSource { $type = null; } - if ($type) { + if (!empty($type)) { echo 'event: ' . $type . PHP_EOL; } echo 'data: ' . json_encode($data) . PHP_EOL; |