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