示例#1
0
文件: Factory.php 项目: geissler/csl
 /**
  * Creates a Day object containing the locale day configuration and the given form the xml.
  *
  * @param string $form text or numeric
  * @param \SimpleXMLElement $xml
  * @return \Geissler\CSL\Date\Day
  */
 public static function day($form, \SimpleXMLElement $xml)
 {
     $standard = Container::getLocale()->getDateAsXml($form, 'day');
     if ($standard !== null) {
         $day = new Day(new \SimpleXMLElement($standard));
         $day->modify($xml);
         return $day;
     }
     return new Day($xml);
 }
示例#2
0
文件: DayTest.php 项目: geissler/csl
 /**
  * @covers Geissler\CSL\Date\Day::render
  * @covers Geissler\CSL\Date\Day::modify
  */
 public function testModifyAndRender()
 {
     $locale = Factory::locale();
     $locale->readFile('fr');
     Container::setLocale($locale);
     $layout = '<date-part name="day" form="ordinal"/>';
     $this->initElement($layout);
     $xml = new \SimpleXMLElement('<date-part name="day" form="numeric"/>');
     $this->assertInstanceOf('\\Geissler\\CSL\\Date\\Day', $this->object->modify($xml));
     $this->assertEquals('1', $this->object->render('1'));
 }