Exemplo n.º 1
0
 protected function createFixture(array $data = array())
 {
     $person = new Person('Scheit', '*****@*****.**', 'Philipp', Date::create('21.11.1984'));
     $formPanel = new EntityFormPanel('Person bearbeiten', $this->getTranslationContainer(), new EntityForm($person, $this->getEntityMeta('Psc\\Doctrine\\TestEntities\\Person')->getSaveRequestMeta($person)));
     $formPanel->createComponents();
     $validator = new ComponentsValidator(new Set(array_merge(array('id' => '17', 'birthday' => '21.11.1984', 'name' => 'Scheit', 'firstName' => 'Philipp ', 'email' => '*****@*****.**', 'yearKnown' => 'true'), $data), $person->getSetMeta()), $formPanel->getEntityForm()->getComponents());
     return $validator;
 }
Exemplo n.º 2
0
 public function convertToPHPValue($value, AbstractPlatform $platform)
 {
     if ($value === null) {
         return null;
     }
     $val = \Psc\DateTime\Date::parse($platform->getDateFormatString(), $value);
     if (!$val) {
         throw ConversionException::conversionFailedFormat($value, $this->getName(), $platform->getDateFormatString());
     }
     return $val;
 }
Exemplo n.º 3
0
 public function testDateExporting()
 {
     $birthdayType = new BirthdayType();
     $birthday = new Date('21.11.1984');
     $this->assertEquals((object) array('date' => $birthday->getTimestamp(), 'timezone' => date_default_timezone_get()), $this->objectExporter->walk($birthday, $birthdayType));
 }
Exemplo n.º 4
0
 public function provideValidData()
 {
     return array(array('12.02.2012', Date::create('12.02.2012'), new DateValidatorRule('d.m.Y')), array('12.02.2012', Date::create('12.02.2012'), new DateValidatorRule('d.m.Y')), array('29.02.2012', Date::create('29.02.2012'), new DateValidatorRule('d.m.Y')), array('29.02.', Date::create('29.02.1972'), new DateValidatorRule('d.m.')), array('28.02.', Date::create('28.02.1970'), new DateValidatorRule('d.m.')));
 }
Exemplo n.º 5
0
 public function icalDate(\Psc\DateTime\Date $date)
 {
     return $date->format(self::ICAL_DATE);
 }