22 $db = $this->getMockbuilder(\ilDBInterface::class)->getMock();
24 $repository = new \ilMailTemplateRepository($db);
36 $db->expects($this->
once())->method(
'nextId')->willReturn($templateId);
37 $db->expects($this->
once())->method(
'insert');
41 $this->assertEquals($templateId,
$template->getTplId());
53 $db = $this->getMockbuilder(\ilDBInterface::class)->getMock();
55 $repository = new \ilMailTemplateRepository($db);
57 $db->expects($this->
once())->method(
'update');
59 $repository->store($template);
70 $db = $this->getMockbuilder(\ilDBInterface::class)->getMock();
72 $repository = new \ilMailTemplateRepository($db);
74 $db->expects($this->
once())->method(
'manipulate');
76 $repository->deleteByIds([$template->
getTplId()]);
84 $db = $this->getMockbuilder(\ilDBInterface::class)->getMock();
85 $statement = $this->getMockbuilder(\ilDBStatement::class)->getMock();
89 $emptyTemplate = new \ilMailTemplate();
90 $emptyTemplate->setTplId($templateId);
92 $db->expects($this->
once())->method(
'queryF')->willReturn($statement);
93 $db->expects($this->
once())->method(
'numRows')->willReturn(1);
94 $db->expects($this->
once())->method(
'fetchAssoc')->willReturn($emptyTemplate->toArray());
96 $repository = new \ilMailTemplateRepository($db);
99 $this->assertEquals($templateId,
$template->getTplId());
109 $db = $this->getMockbuilder(\ilDBInterface::class)->getMock();
110 $statement = $this->getMockbuilder(\ilDBStatement::class)->getMock();
112 $db->expects($this->
once())->method(
'queryF')->willReturn($statement);
113 $db->expects($this->
once())->method(
'numRows')->willReturn(0);
114 $db->expects($this->never())->method(
'fetchAssoc');
116 $repository = new \ilMailTemplateRepository($db);
117 $repository->findById(4711);
testExceptionIsRaisedIfNoTemplateCanBeFoundById()
Class ilMailTemplateRepository.
testEntityCanBeModified(\ilMailTemplate $template)
testEntityCanBeSaved
testTemplateCanBeFoundById()
testEntityCanBeDeleted(\ilMailTemplate $template)
testEntityCanBeModified
assertException($exception_class)
once($eventName, callable $callBack, $priority=100)
Subscribe to an event exactly once.