Skip to content

Commit b95c1c6

Browse files
committed
IBX-11818: used data provider for testToStorageValueMissingData
1 parent f08a3f5 commit b95c1c6

1 file changed

Lines changed: 18 additions & 16 deletions

File tree

tests/lib/Persistence/Legacy/Content/FieldValue/Converter/DateAndTimeTest.php

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -85,33 +85,35 @@ public function testToFieldValue()
8585
}
8686

8787
/**
88-
* @group fieldType
89-
* @group dateTime
88+
* @return mixed[]
9089
*/
91-
public function testToStorageValueNoTimestampKey(): void
90+
public function providerForTestToStorageValueMissingData(): array
9291
{
93-
$value = new FieldValue();
94-
$value->data = [
95-
'current_time' => $this->date->getTimestamp(),
96-
'rfc850' => $this->date->format(DateTime::RFC850),
92+
return [
93+
[
94+
[
95+
'current_time' => 1048633200,
96+
'rfc850' => 'Thu, 01 Jan 2003 00:00:00 GMT',
97+
],
98+
],
99+
[
100+
null,
101+
]
97102
];
98-
$value->sortKey = $this->date->getTimestamp();
99-
$storageFieldValue = new StorageFieldValue();
100-
101-
$this->converter->toStorageValue($value, $storageFieldValue);
102-
self::assertNull($storageFieldValue->dataInt);
103-
self::assertSame($value->sortKey, $storageFieldValue->sortKeyInt);
104-
self::assertSame('', $storageFieldValue->sortKeyString);
105103
}
106104

107105
/**
108106
* @group fieldType
109107
* @group dateTime
108+
*
109+
* @dataProvider providerForTestToStorageValueMissingData
110+
*
111+
* @param mixed[]|null $data
110112
*/
111-
public function testToStorageValueValueDataNull(): void
113+
public function testToStorageValueNoTimestampKey(?array $data): void
112114
{
113115
$value = new FieldValue();
114-
$value->data = null;
116+
$value->data = $data;
115117
$value->sortKey = $this->date->getTimestamp();
116118
$storageFieldValue = new StorageFieldValue();
117119

0 commit comments

Comments
 (0)