diff options
Diffstat (limited to 'tests/lib/AppFramework/Middleware/NotModifiedMiddlewareTest.php')
-rw-r--r-- | tests/lib/AppFramework/Middleware/NotModifiedMiddlewareTest.php | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/tests/lib/AppFramework/Middleware/NotModifiedMiddlewareTest.php b/tests/lib/AppFramework/Middleware/NotModifiedMiddlewareTest.php index 58ae6b13aed..7dcb28a2af4 100644 --- a/tests/lib/AppFramework/Middleware/NotModifiedMiddlewareTest.php +++ b/tests/lib/AppFramework/Middleware/NotModifiedMiddlewareTest.php @@ -11,6 +11,7 @@ namespace Test\AppFramework\Middleware; use OC\AppFramework\Middleware\NotModifiedMiddleware; use OCP\AppFramework\Controller; use OCP\AppFramework\Http; +use OCP\AppFramework\Http\Response; use OCP\IRequest; class NotModifiedMiddlewareTest extends \Test\TestCase { @@ -32,7 +33,7 @@ class NotModifiedMiddlewareTest extends \Test\TestCase { $this->controller = $this->createMock(Controller::class); } - public function dataModified(): array { + public static function dataModified(): array { $now = new \DateTime(); return [ @@ -43,19 +44,17 @@ 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], ]; } - /** - * @dataProvider dataModified - */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataModified')] public function testMiddleware(?string $etag, string $etagHeader, ?\DateTime $lastModified, string $lastModifiedHeader, bool $notModifiedSet): void { $this->request->method('getHeader') ->willReturnCallback(function (string $name) use ($etagHeader, $lastModifiedHeader) { @@ -68,7 +67,7 @@ class NotModifiedMiddlewareTest extends \Test\TestCase { return ''; }); - $response = new Http\Response(); + $response = new Response(); if ($etag !== null) { $response->setETag($etag); } |