eZ\Publish\Core\Persistence\Legacy\Tests\Content\FieldValue\Converter\DateAndTimeTest::testToStorageFieldDefinitionWithAdjustment PHP Method

testToStorageFieldDefinitionWithAdjustment() public method

    public function testToStorageFieldDefinitionWithAdjustment()
    {
        $storageFieldDef = new StorageFieldDefinition();
        $dateInterval = DateInterval::createFromDateString('+10 years, -1 month, +3 days, -13 hours');
        $fieldTypeConstraints = new FieldTypeConstraints();
        $fieldTypeConstraints->fieldSettings = new FieldSettings(array('useSeconds' => true, 'defaultType' => DateAndTimeType::DEFAULT_CURRENT_DATE_ADJUSTED, 'dateInterval' => $dateInterval));
        $fieldDef = new PersistenceFieldDefinition(array('fieldTypeConstraints' => $fieldTypeConstraints));
        $this->converter->toStorageFieldDefinition($fieldDef, $storageFieldDef);
        self::assertSame(DateAndTimeType::DEFAULT_CURRENT_DATE_ADJUSTED, $storageFieldDef->dataInt1);
        self::assertSame(1, $storageFieldDef->dataInt2);
        $xml = new SimpleXMLElement($storageFieldDef->dataText5);
        foreach ($this->getXMLToDateIntervalMap() as $xmlNode => $property) {
            self::assertSame($dateInterval->format("%{$property}"), (string) $xml->{$xmlNode}['value']);
        }
    }