mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2026-04-18 11:59:31 +00:00
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:
@@ -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),
|
||||
];
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user