public function testModel()
 {
     /* @var LayoutInterface $layout */
     $layout = $this->getMockBuilder(LayoutInterface::class)->getMock();
     $translation = new LayoutTranslation($layout);
     $translation->setLocale('fr')->setLabel('Label of translation')->setDescription('Description of translation')->setBody('Body of translation');
     $this->assertSame($layout, $translation->getLayout());
     $this->assertSame('fr', $translation->getLocale());
     $this->assertSame('Label of translation', $translation->getLabel());
     $this->assertSame('Description of translation', $translation->getDescription());
     $this->assertSame('Body of translation', $translation->getBody());
 }
 /**
  * @param bool|false $withTranslation
  * @param bool|false $withTranslationDomain
  *
  * @return Layout
  */
 protected function createLayout($withTranslation = false, $withTranslationDomain = false)
 {
     $layout = new Layout();
     $layout->setName('test')->setLabel('Test')->setDescription('Description of template')->setEnabled(true)->setBody('Body of template')->setTranslationDomain($withTranslationDomain ? 'domain' : null);
     if ($withTranslation && !$withTranslationDomain) {
         $translation = new LayoutTranslation($layout);
         $translation->setLocale('fr')->setLabel('Label of translation')->setDescription('Description of translation')->setBody('Body of translation');
     }
     return $layout;
 }
Exemplo n.º 3
0
 /**
  * Get the layout and translation models.
  *
  * @param string $locale The locale
  *
  * @return array The layout and translation
  */
 protected function getModels($locale)
 {
     $layout = new Layout();
     $layout->setName('test')->setLabel('Label of template')->setDescription('Description of template')->setBody('Body of template');
     $translation = new LayoutTranslation($layout);
     $translation->setLocale($locale)->setLabel('Label of translated template')->setDescription('Description of translated template')->setBody('Body of translated template');
     return array($layout, $translation);
 }