/** * {@inheritdoc} */ protected function getIntlDateFormatter() { $formatter = parent::getIntlDateFormatter(); $this->setTimezone($formatter->getTimezone()); $this->setCalendar($formatter->getCalendar()); $this->setPattern($formatter->getPattern()); return $formatter; }
/** * @expectedException \Opg\Common\Model\Entity\Exception\InvalidDateFormatException */ public function testGetSetPaymentDate() { $expectedDateTime = new \DateTime(); $expectedDateTimeString = $expectedDateTime->format(DateFormat::getDateFormat()); $this->assertNull($this->paymentType->getPaymentDate()); $this->assertEmpty($this->paymentType->getDateAsString('paymentDate')); $this->assertEquals($expectedDateTime, $this->paymentType->setPaymentDate($expectedDateTime)->getPaymentDate()); $this->assertEquals($expectedDateTimeString, $this->paymentType->setDateFromString($expectedDateTimeString, 'paymentDate')->getDateAsString('paymentDate')); $this->paymentType->setDateFromString('Last thursday around 3pm', 'paymentDate'); }
/** * Ensures that setting the pattern results in pattern used (by the validation process) */ public function testOptionPattern() { $this->validator->setOptions(array('pattern' => 'hh:mm')); $this->assertTrue($this->validator->isValid('02:00')); $this->assertEquals('hh:mm', $this->validator->getPattern()); }