示例#1
0
 /**
  * @param LangModel $lang
  * @depends testCreate
  * @return LangModel
  */
 public function testUpdate(LangModel $lang)
 {
     $event = new LangUpdateEvent($lang->getId());
     $event->setLocale('te_TE')->setTitle('test update')->setCode('TEST')->setDateFormat('d-m-Y')->setTimeFormat('H-i-s')->setDecimalSeparator(",")->setThousandsSeparator(".")->setDecimals("1");
     $action = new Lang(new TheliaTemplateHelper(), $this->requestStack);
     $action->update($event, null, $this->getMockEventDispatcher());
     $updatedLang = $event->getLang();
     $this->assertInstanceOf('Thelia\\Model\\Lang', $updatedLang);
     $this->assertEquals('te_TE', $updatedLang->getLocale());
     $this->assertEquals('TEST', $updatedLang->getCode());
     $this->assertEquals('test update', $updatedLang->getTitle());
     $this->assertEquals('d-m-Y', $updatedLang->getDateFormat());
     $this->assertEquals('H-i-s', $updatedLang->getTimeFormat());
     $this->assertEquals(',', $updatedLang->getDecimalSeparator());
     $this->assertEquals('.', $updatedLang->getThousandsSeparator());
     $this->assertEquals('1', $updatedLang->getDecimals());
     $this->assertEquals('d-m-Y H-i-s', $updatedLang->getDatetimeFormat());
     // set a specific date/time format
     $event->setDateTimeFormat('d/m/Y H:i:s');
     $action->update($event, null, $this->getMockEventDispatcher());
     $updatedLang = $event->getLang();
     $this->assertInstanceOf('Thelia\\Model\\Lang', $updatedLang);
     $this->assertEquals('d/m/Y H:i:s', $updatedLang->getDatetimeFormat());
     return $updatedLang;
 }
示例#2
0
 /**
  * @param LangModel $lang
  * @depends testCreate
  */
 public function testUpdate(LangModel $lang)
 {
     $event = new LangUpdateEvent($lang->getId());
     $event->setLocale('te_TE')->setTitle('test update')->setCode('TEST')->setDateFormat('d-m-Y')->setTimeFormat('H-i-s')->setDecimalSeparator(",")->setThousandsSeparator(".")->setDecimals("1")->setDispatcher($this->dispatcher);
     $action = new Lang();
     $action->update($event);
     $updatedLang = $event->getLang();
     $this->assertInstanceOf('Thelia\\Model\\Lang', $updatedLang);
     $this->assertEquals('te_TE', $updatedLang->getLocale());
     $this->assertEquals('TEST', $updatedLang->getCode());
     $this->assertEquals('test update', $updatedLang->getTitle());
     $this->assertEquals('d-m-Y', $updatedLang->getDateFormat());
     $this->assertEquals('H-i-s', $updatedLang->getTimeFormat());
     $this->assertEquals(',', $updatedLang->getDecimalSeparator());
     $this->assertEquals('.', $updatedLang->getThousandsSeparator());
     $this->assertEquals('1', $updatedLang->getDecimals());
     $this->assertEquals('d-m-Y H-i-s', $updatedLang->getDatetimeFormat());
     return $updatedLang;
 }
示例#3
0
文件: Lang.php 项目: margery/thelia
 public function update(LangUpdateEvent $event)
 {
     if (null !== ($lang = LangQuery::create()->findPk($event->getId()))) {
         $lang->setDispatcher($event->getDispatcher());
         $lang->setTitle($event->getTitle())->setLocale($event->getLocale())->setCode($event->getCode())->setDateFormat($event->getDateFormat())->setTimeFormat($event->getTimeFormat())->setDecimalSeparator($event->getDecimalSeparator())->setThousandsSeparator($event->getThousandsSeparator())->setDecimals($event->getDecimals())->save();
         $event->setLang($lang);
     }
 }