/**
  * Create newsletter template
  *
  * @param Template $template
  */
 public function testCreateNewsletterTemplate(Template $template)
 {
     // Steps
     $this->templateIndex->open();
     $this->templateIndex->getGridPageActions()->addNew();
     $this->templateNewIndex->getEditForm()->fill($template);
     $this->templateNewIndex->getFormPageActions()->save();
 }
 /**
  * Action for Newsletter Template
  *
  * @param Template $newsletter
  * @param string $action
  * @return void
  */
 public function test(Template $newsletter, $action)
 {
     // Preconditions
     $newsletter->persist();
     // Steps
     $this->templateIndex->open();
     $this->templateIndex->getNewsletterTemplateGrid()->search(['code' => $newsletter->getCode()]);
     $this->templateIndex->getNewsletterTemplateGrid()->performAction($action);
 }
 /**
  * Run Update Newsletter test
  *
  * @param Template $templateInitial
  * @param Template $template
  * @return void
  */
 public function test(Template $templateInitial, Template $template)
 {
     // Preconditions:
     $templateInitial->persist();
     // Steps:
     $this->templateIndex->open();
     $this->templateIndex->getNewsletterTemplateGrid()->searchAndOpen(['code' => $templateInitial->getCode()]);
     $this->templateEdit->getEditForm()->fill($template);
     $this->templateEdit->getFormPageActions()->save();
 }
 /**
  * Action for Newsletter Template
  *
  * @param Template $newsletter
  * @return void
  */
 public function test(Template $newsletter)
 {
     // Preconditions
     $newsletter->persist();
     // Steps
     // 1. Open Backend
     // 2. Go to "Marketing" -> "Newsletter Template"
     $this->templateIndex->open();
     // 3. Find created template in grid and open it
     $this->templateIndex->getNewsletterTemplateGrid()->searchAndOpen(['code' => $newsletter->getCode()]);
     // 4. Click "Preview Template" button at the top of the page
     $this->templateNewIndex->getFormPageActions()->clickPreview();
 }
 /**
  * Assert that success message is displayed after newsletter template save
  *
  * @param TemplateIndex $templateIndex
  */
 public function processAssert(TemplateIndex $templateIndex)
 {
     $actualMessage = $templateIndex->getMessagesBlock()->getSuccessMessage();
     \PHPUnit_Framework_Assert::assertEquals(self::SUCCESS_MESSAGE, $actualMessage, 'Wrong success message is displayed.' . "\nExpected: " . self::SUCCESS_MESSAGE . "\nActual: " . $actualMessage);
 }
 /**
  * Assert that newsletter template form data equals to data passed from fixture
  *
  * @param TemplateIndex $templateIndex
  * @param TemplateEdit $templateEdit
  * @param Template $template
  * @return void
  */
 public function processAssert(TemplateIndex $templateIndex, TemplateEdit $templateEdit, Template $template)
 {
     $templateIndex->open()->getNewsletterTemplateGrid()->searchAndOpen(['code' => $template->getCode()]);
     $errors = $this->verifyData($template->getData(), $templateEdit->getEditForm()->getData($template));
     \PHPUnit_Framework_Assert::assertEmpty($errors, $errors);
 }
 /**
  *  Assert that newsletter template is present in grid
  *
  * @param TemplateIndex $templateIndex
  * @param Template $template
  * @return void
  */
 public function processAssert(TemplateIndex $templateIndex, Template $template)
 {
     $templateIndex->open();
     $filter = ['code' => $template->getCode()];
     \PHPUnit_Framework_Assert::assertTrue($templateIndex->getNewsletterTemplateGrid()->isRowVisible($filter), 'Newsletter \'' . $template->getCode() . '\'is absent in newsletter template grid.');
 }