public function testGetTemplates()
 {
     $model = new Template();
     $model->setTemplateId(1)->setName('Test');
     $mapperMock = $this->getMockBuilder('UthandoNewsletter\\Mapper\\Template')->disableOriginalConstructor()->getMock();
     $serviceManagerMock = $this->getMockBuilder('UthandoCommon\\Service\\ServiceManager')->disableOriginalConstructor()->getMock();
     $mapperMock->expects($this->once())->method('fetchAll')->will($this->returnValue(array($model)));
     $serviceManagerMock->expects($this->once())->method('get')->with('UthandoNewsletterTemplate')->will($this->returnValue($mapperMock));
     $this->serviceManager->setAllowOverride(true);
     $this->serviceManager->setService('UthandoServiceManager', $serviceManagerMock);
     /* @var $form Template */
     $form = $this->serviceManager->get('FormElementManager')->get('UthandoNewsLetterTemplateList');
     $this->assertSame([1 => 'Test'], $form->getValueOptions());
 }
 public function testSetGetParams()
 {
     $this->model->setParams('test_param=test');
     $this->assertSame('test_param=test', $this->model->getParams());
 }
 /**
  * @param Template|Message $model
  * @return string
  */
 public function parseParams($model)
 {
     $iniReader = new Ini();
     $params = $iniReader->fromString($model->getParams());
     if ($model instanceof Message) {
         $params = array_merge(parse_ini_string($model->getTemplate()->getParams()), $params);
     }
     $this->setVariables($params);
 }
Пример #4
0
 /**
  * @param TemplateModel $object
  * @return array
  */
 public function extract($object)
 {
     return ['templateId' => $object->getTemplateId(), 'name' => $object->getName(), 'params' => $object->getParams(), 'body' => $object->getBody()];
 }