/** * @test */ public function defaultValuesForPropertiesHandlesDateTypes() { $nodeType = new NodeType('Neos.ContentRepository:Base', array(), array('properties' => array('date' => array('type' => 'DateTime', 'defaultValue' => '2014-09-23')))); $this->assertEquals($nodeType->getDefaultValuesForProperties(), array('date' => new \DateTime('2014-09-23'))); }
/** * Tries to find a default value for the given property trying: * 1) The specific property configuration for the given NodeType * 2) The generic configuration for the property type in setings. * * @param NodeType $nodeType * @param string $propertyName * @return mixed */ protected function getDefaultValueForProperty(NodeType $nodeType, $propertyName) { $defaultValues = $nodeType->getDefaultValuesForProperties(); if (!isset($defaultValues[$propertyName])) { return null; } return $defaultValues[$propertyName]; }