Add createdAt field normalization in StoredObjectLockNormalizer and update related test

- Modified `StoredObjectLockNormalizer` to include the `createdAt` field in the normalized output.
- Updated `StoredObjectLockNormalizerTest` to reflect the new `createdAt` field, including test assertions and normalization logic adjustments.
This commit is contained in:
2026-04-10 12:33:14 +02:00
parent 3905b7c9a7
commit 4c86dcb9ff
2 changed files with 7 additions and 2 deletions

View File

@@ -27,6 +27,7 @@ final class StoredObjectLockNormalizer implements NormalizerInterface, Normalize
return [
'uuid' => $object->getUuid(),
'method' => $object->getMethod(),
'createdAt' => $this->normalizer->normalize($object->getCreatedAt(), $format, $context),
'expiresAt' => $this->normalizer->normalize($object->getExpireAt(), $format, $context),
'users' => $this->normalizer->normalize($object->getUsers()->getValues(), $format, $context),
];

View File

@@ -66,10 +66,13 @@ class StoredObjectLockNormalizerTest extends TestCase
[$user]
);
$this->childNormalizer->expects($this->exactly(2))
$this->childNormalizer->expects($this->exactly(3))
->method('normalize')
->withAnyParameters()
->willReturnCallback(function ($data, $format, $context) use ($expireAt, $user) {
->willReturnCallback(function ($data, $format, $context) use ($createdAt, $expireAt, $user) {
if ($data === $createdAt) {
return '2026-04-08T22:00:00+00:00';
}
if ($data === $expireAt) {
return '2026-04-08T23:00:00+00:00';
}
@@ -85,6 +88,7 @@ class StoredObjectLockNormalizerTest extends TestCase
$this->assertEquals([
'uuid' => $lock->getUuid(),
'method' => StoredObjectLockMethodEnum::WEBDAV,
'createdAt' => '2026-04-08T22:00:00+00:00',
'expiresAt' => '2026-04-08T23:00:00+00:00',
'users' => [['username' => 'testuser']],
], $result);