$this->definitionInstanceRegistry =
$this->
createMock(DefinitionInstanceRegistry::
class);
$this->validator =
$this->
createMock(ValidatorInterface::
class);
$this->dateIntervalFieldSerializer =
new DateIntervalFieldSerializer( $this->validator,
$this->definitionInstanceRegistry
);
} public function testEncodeMethodWithCorrectDataWillReturnDateIntervalString(): void
{ $data =
new KeyValuePair('key',
new \
DateInterval('P2Y5D'
), false
);
$iterator =
$this->dateIntervalFieldSerializer->
encode( new DateIntervalField('fake', 'fake'
),
$this->
createStub(EntityExistence::
class),
$data,
$this->
createMock(WriteParameterBag::
class) );
$dateIntervalString =
$iterator->
current();
\
iterator_to_array($iterator);