-
Notifications
You must be signed in to change notification settings - Fork 19
IBX-11818: added fallback to null value when key 'timestamp' not exists in $value->data array #757
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 5.0
Are you sure you want to change the base?
Changes from all commits
e95881c
589981f
eef490c
f08a3f5
b95c1c6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| <?php | ||
|
Check warning on line 1 in tests/lib/Persistence/Legacy/Content/FieldValue/Converter/DateAndTimeTest.php
|
||
|
|
||
| /** | ||
| * @copyright Copyright (C) Ibexa AS. All rights reserved. | ||
|
|
@@ -84,6 +84,45 @@ | |
| self::assertSame($storageFieldValue->sortKeyInt, $fieldValue->sortKey); | ||
| } | ||
|
|
||
| /** | ||
| * @return mixed[] | ||
| */ | ||
| public function providerForTestToStorageValueMissingData(): array | ||
| { | ||
| return [ | ||
| [ | ||
| [ | ||
| 'current_time' => 1048633200, | ||
| 'rfc850' => 'Thu, 01 Jan 2003 00:00:00 GMT', | ||
| ], | ||
|
Comment on lines
+94
to
+97
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need to wrap it in several arrays? |
||
| ], | ||
| [ | ||
| null, | ||
| ] | ||
| ]; | ||
| } | ||
|
|
||
| /** | ||
| * @group fieldType | ||
| * @group dateTime | ||
| * | ||
| * @dataProvider providerForTestToStorageValueMissingData | ||
| * | ||
| * @param mixed[]|null $data | ||
| */ | ||
| public function testToStorageValueNoTimestampKey(?array $data): void | ||
| { | ||
| $value = new FieldValue(); | ||
| $value->data = $data; | ||
| $value->sortKey = $this->date->getTimestamp(); | ||
| $storageFieldValue = new StorageFieldValue(); | ||
|
|
||
| $this->converter->toStorageValue($value, $storageFieldValue); | ||
| self::assertNull($storageFieldValue->dataInt); | ||
| self::assertSame($value->sortKey, $storageFieldValue->sortKeyInt); | ||
| self::assertSame('', $storageFieldValue->sortKeyString); | ||
| } | ||
|
|
||
| /** | ||
| * @group fieldType | ||
| * @group dateTime | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we are SO CLOSE to this. Can we drop that comment? ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should I just remove it?
Or somehow store the timezone here? 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove it.