Skip to content

Commit

Permalink
Fix unit test for updating email template
Browse files Browse the repository at this point in the history
refs #424
  • Loading branch information
Gerd Katzenbeisser committed Sep 29, 2024
1 parent 6059360 commit d294f8a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tests/Presenters/Admin/ManageEmailTemplatesPresenterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,12 @@ public function testUpdatesEmailTemplate()
$this->page->_UpdatedTemplateName = $templateName;
$this->page->_TemplateContents = $contents;
$this->page->_Language = 'en_us';
$this->page->_UpdatedLanguage = 'cz';

$this->presenter->UpdateEmailTemplate();

$this->assertEquals($contents, $this->fileSystem->_AddedFileContents);
$this->assertEquals(Paths::EmailTemplates('en_us'), $this->fileSystem->_AddedFilePath);
$this->assertEquals(Paths::EmailTemplates('cz'), $this->fileSystem->_AddedFilePath);
$this->assertEquals('template-custom.tpl', $this->fileSystem->_AddedFileName);
}
}
Expand All @@ -91,6 +92,7 @@ class FakeManageEmailTemplatesPage extends ManageEmailTemplatesPage
public $_BoundTemplateContents;
public $_TemplateContents;
public $_Language;
public $_UpdatedLanguage;
public $_SaveResult = true;

public function BindTemplateNames($templates)
Expand Down Expand Up @@ -123,6 +125,11 @@ public function GetLanguage()
return $this->_Language;
}

public function GetUpdatedLanguage(): string
{
return $this->_UpdatedLanguage;
}

public function SetSaveResult($saveResult)
{
$this->_SaveResult = $saveResult;
Expand Down

0 comments on commit d294f8a

Please sign in to comment.