22 $repo = $this->getMockbuilder(\ilMailTemplateRepository::class)->disableOriginalConstructor()->getMock();
30 $otherTemplate->setTplId(2);
31 $otherTemplate->setAsDefault(
false);
34 $yetAnotherTemplate->setTplId(3);
35 $yetAnotherTemplate->setAsDefault(
true);
43 $repo->expects($this->
once())->method(
'findByContextId')->with($template->getContext())->willReturn($all);
44 $repo->expects($this->exactly(count($all)))->method(
'store');
45 $service = new \ilMailTemplateService($repo);
47 $service->setAsContextDefault($template);
49 $this->assertTrue($template->isDefault());
50 $this->assertFalse($otherTemplate->isDefault());
51 $this->assertFalse($yetAnotherTemplate->isDefault());
59 $repo = $this->getMockbuilder(\ilMailTemplateRepository::class)->disableOriginalConstructor()->getMock();
66 $repo->expects($this->
once())->method(
'store')->with(
$template);
67 $service = new \ilMailTemplateService($repo);
69 $service->unsetAsContextDefault(
$template);
71 $this->assertFalse(
$template->isDefault());
Class ilMailTemplateServiceTest.
testDefaultTemplateForContextCanBeUnset()
once($eventName, callable $callBack, $priority=100)
Subscribe to an event exactly once.
testDefaultTemplateCanBeSetByContext()