public function testContainsValidDateFormatRule()
 {
     $formatOption = 'F Y/m/d H:i:s';
     $language = $this->getMockBuilder('\\Language')->disableOriginalConstructor()->getMock();
     $instance = new IntlTimeFormatter(DITime::doUnserialize('1/2000/12/12/1/1/20.200'), $language);
     $this->assertTrue($instance->containsValidDateFormatRule($formatOption));
 }
 /**
  * @since 2.4
  *
  * @param  DITime|null $dataItem
  *
  * @return string
  */
 public function getCaptionFromFreeFormat(DITime $dataItem = null)
 {
     $language = Localizer::getInstance()->getLanguage($this->dataValue->getOptionBy(DataValue::OPT_USER_LANGUAGE));
     // Prehistory dates are not supported when using this output format
     // Only match options encapsulated by [ ... ]
     if ($dataItem !== null && $dataItem->getYear() > DITime::PREHISTORY && preg_match("/\\[([^\\]]*)\\]/", $this->dataValue->getOutputFormat(), $matches)) {
         $intlTimeFormatter = new IntlTimeFormatter($dataItem, $language);
         if (($caption = $intlTimeFormatter->format($matches[1])) !== false) {
             if ($intlTimeFormatter->containsValidDateFormatRule($matches[1])) {
                 $caption .= $this->hintCalendarModel($dataItem);
             }
             return $caption;
         }
     }
     return $this->getISO8601Date();
 }