/** * @covers Geissler\CSL\Date\Month::render * @covers Geissler\CSL\Date\Month::modify */ public function testModifyAndRender() { $layout = '<date-part name="month" form="numeric"/>'; $this->initElement($layout); $xml = new \SimpleXMLElement('<date-part name="month" form="numeric-leading-zeros"/>'); $this->assertInstanceOf('\\Geissler\\CSL\\Date\\Month', $this->object->modify($xml)); $this->assertEquals('01', $this->object->render('1')); }
/** * Creates a Month object containing the locale month configuration and the given form the xml. * * @param string $form text or numeric * @param \SimpleXMLElement $xml * @return \Geissler\CSL\Date\Month */ public static function month($form, \SimpleXMLElement $xml) { $standard = Container::getLocale()->getDateAsXml($form, 'month'); if ($standard !== null) { $month = new Month(new \SimpleXMLElement($standard)); return $month->modify($xml); } return new Month($xml); }