ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilCertificateTemplateDeleteActionTest.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
25 {
26  public function testDeleteTemplateAndUseOldThumbnail(): void
27  {
28  $templateRepositoryMock = $this->getMockBuilder(ilCertificateTemplateRepository::class)->getMock();
29 
30  $templateRepositoryMock
31  ->method('deleteTemplate')
32  ->with(100, 2000);
33 
34  $templateRepositoryMock->method('activatePreviousCertificate')
35  ->with(2000)
36  ->willReturn(new ilCertificateTemplate(
37  2000,
38  'crs',
39  'something',
40  md5('something'),
41  '[]',
42  1,
43  'v5.4.0',
44  1234567890,
45  true,
46  'samples/background.jpg'
47  ));
48 
49  $templateRepositoryMock->expects($this->once())->method("deleteTemplate");
50  $templateRepositoryMock->expects($this->once())->method("save");
51 
52  $utilHelper = $this->getMockBuilder(ilCertificateUtilHelper::class)
53  ->getMock();
54 
55  $objectHelper = $this->getMockBuilder(ilCertificateObjectHelper::class)
56  ->getMock();
57 
58  $objectHelper->method('lookUpType')
59  ->willReturn('crs');
60 
62  $templateRepositoryMock,
63  __DIR__,
64  $utilHelper,
65  $objectHelper,
66  'v5.4.0'
67  );
68 
69  $action->delete(100, 2000);
70  }
71 }
Class ilCertificateBaseTestCase.