aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib')
-rw-r--r--tests/lib/AppFramework/Http/ResponseTest.php6
-rw-r--r--tests/lib/AppFramework/Middleware/NotModifiedMiddlewareTest.php6
-rw-r--r--tests/lib/Group/HideFromCollaborationTest.php53
-rw-r--r--tests/lib/Preview/MovieBrokenStuckFfmpegTest.php20
-rw-r--r--tests/lib/Preview/MovieTest.php9
5 files changed, 84 insertions, 10 deletions
diff --git a/tests/lib/AppFramework/Http/ResponseTest.php b/tests/lib/AppFramework/Http/ResponseTest.php
index 28614b14b40..c129b5637c5 100644
--- a/tests/lib/AppFramework/Http/ResponseTest.php
+++ b/tests/lib/AppFramework/Http/ResponseTest.php
@@ -229,7 +229,7 @@ class ResponseTest extends \Test\TestCase {
$headers = $this->childResponse->getHeaders();
$this->assertEquals('private, max-age=33, must-revalidate', $headers['Cache-Control']);
- $this->assertEquals('Thu, 15 Jan 1970 06:56:40 +0000', $headers['Expires']);
+ $this->assertEquals('Thu, 15 Jan 1970 06:56:40 GMT', $headers['Expires']);
}
@@ -239,7 +239,7 @@ class ResponseTest extends \Test\TestCase {
$lastModified->setTimestamp(1);
$this->childResponse->setLastModified($lastModified);
$headers = $this->childResponse->getHeaders();
- $this->assertEquals('Thu, 01 Jan 1970 00:00:01 +0000', $headers['Last-Modified']);
+ $this->assertEquals('Thu, 01 Jan 1970 00:00:01 GMT', $headers['Last-Modified']);
}
public function testChainability(): void {
@@ -257,7 +257,7 @@ class ResponseTest extends \Test\TestCase {
$this->assertEquals('world', $headers['hello']);
$this->assertEquals(Http::STATUS_NOT_FOUND, $this->childResponse->getStatus());
$this->assertEquals('hi', $this->childResponse->getEtag());
- $this->assertEquals('Thu, 01 Jan 1970 00:00:01 +0000', $headers['Last-Modified']);
+ $this->assertEquals('Thu, 01 Jan 1970 00:00:01 GMT', $headers['Last-Modified']);
$this->assertEquals('private, max-age=33, must-revalidate',
$headers['Cache-Control']);
}
diff --git a/tests/lib/AppFramework/Middleware/NotModifiedMiddlewareTest.php b/tests/lib/AppFramework/Middleware/NotModifiedMiddlewareTest.php
index 204cc647cad..d80df1841c8 100644
--- a/tests/lib/AppFramework/Middleware/NotModifiedMiddlewareTest.php
+++ b/tests/lib/AppFramework/Middleware/NotModifiedMiddlewareTest.php
@@ -43,13 +43,13 @@ class NotModifiedMiddlewareTest extends \Test\TestCase {
[null, '"etag"', null, '', false],
['etag', '"etag"', null, '', true],
- [null, '', $now, $now->format(\DateTimeInterface::RFC2822), true],
+ [null, '', $now, $now->format(\DateTimeInterface::RFC7231), true],
[null, '', $now, $now->format(\DateTimeInterface::ATOM), false],
- [null, '', null, $now->format(\DateTimeInterface::RFC2822), false],
+ [null, '', null, $now->format(\DateTimeInterface::RFC7231), false],
[null, '', $now, '', false],
['etag', '"etag"', $now, $now->format(\DateTimeInterface::ATOM), true],
- ['etag', '"etag"', $now, $now->format(\DateTimeInterface::RFC2822), true],
+ ['etag', '"etag"', $now, $now->format(\DateTimeInterface::RFC7231), true],
];
}
diff --git a/tests/lib/Group/HideFromCollaborationTest.php b/tests/lib/Group/HideFromCollaborationTest.php
new file mode 100644
index 00000000000..5ff7c797508
--- /dev/null
+++ b/tests/lib/Group/HideFromCollaborationTest.php
@@ -0,0 +1,53 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+namespace Test\Group;
+
+use OC\Group\Group;
+use OCP\EventDispatcher\IEventDispatcher;
+use OCP\Group\Backend\ABackend;
+use OCP\Group\Backend\IHideFromCollaborationBackend;
+use OCP\IUserManager;
+use PHPUnit\Framework\MockObject\MockObject;
+use Test\TestCase;
+
+abstract class HideFromCollaborationBackendTest extends ABackend implements IHideFromCollaborationBackend {
+
+}
+
+class HideFromCollaborationTest extends TestCase {
+
+ private IUserManager&MockObject $userManager;
+ private IEventDispatcher&MockObject $dispatcher;
+
+ protected function setUp(): void {
+ parent::setUp();
+
+ $this->userManager = $this->createMock(IUserManager::class);
+ $this->dispatcher = $this->createMock(IEventDispatcher::class);
+ }
+
+
+ public function testHideFromCollaboration(): void {
+ // Arrange
+ $backend1 = $this->createMock(HideFromCollaborationBackendTest::class);
+ $backend1->method('hideGroup')
+ ->willReturn(false);
+ $backend2 = $this->createMock(HideFromCollaborationBackendTest::class);
+ $backend2->method('hideGroup')
+ ->willReturn(true);
+ $group = new Group('group1', [$backend1, $backend2], $this->dispatcher, $this->userManager);
+
+ // Act
+ $result = $group->hideFromCollaboration();
+
+ // Assert
+ $this->assertTrue($result);
+ }
+}
diff --git a/tests/lib/Preview/MovieBrokenStuckFfmpegTest.php b/tests/lib/Preview/MovieBrokenStuckFfmpegTest.php
new file mode 100644
index 00000000000..e66d5e64649
--- /dev/null
+++ b/tests/lib/Preview/MovieBrokenStuckFfmpegTest.php
@@ -0,0 +1,20 @@
+<?php
+
+declare(strict_types=1);
+/**
+ * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+namespace Test\Preview;
+
+/**
+ * Class MovieTest
+ *
+ * @group DB
+ *
+ * @package Test\Preview
+ */
+class MovieBrokenStuckFfmpegTest extends MovieTest {
+ protected string $fileName = 'broken-video.webm';
+}
diff --git a/tests/lib/Preview/MovieTest.php b/tests/lib/Preview/MovieTest.php
index b8946ad4c5e..6009943b89d 100644
--- a/tests/lib/Preview/MovieTest.php
+++ b/tests/lib/Preview/MovieTest.php
@@ -18,6 +18,10 @@ use OCP\Server;
* @package Test\Preview
*/
class MovieTest extends Provider {
+ protected string $fileName = 'testimage.mp4';
+ protected int $width = 560;
+ protected int $height = 320;
+
protected function setUp(): void {
$binaryFinder = Server::get(IBinaryFinder::class);
$movieBinary = $binaryFinder->findBinaryPath('avconv');
@@ -28,10 +32,7 @@ class MovieTest extends Provider {
if (is_string($movieBinary)) {
parent::setUp();
- $fileName = 'testimage.mp4';
- $this->imgPath = $this->prepareTestFile($fileName, \OC::$SERVERROOT . '/tests/data/' . $fileName);
- $this->width = 560;
- $this->height = 320;
+ $this->imgPath = $this->prepareTestFile($this->fileName, \OC::$SERVERROOT . '/tests/data/' . $this->fileName);
$this->provider = new \OC\Preview\Movie(['movieBinary' => $movieBinary]);
} else {
$this->markTestSkipped('No Movie provider present');