ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilCertificateTemplateDeleteActionTest.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2018 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
8 {
10  {
11  $templateRepositoryMock = $this->getMockBuilder('ilCertificateTemplateRepository')
12  ->disableOriginalConstructor()
13  ->getMock();
14 
15  $templateRepositoryMock
16  ->method('deleteTemplate')
17  ->with(100, 2000);
18 
19  $templateRepositoryMock->method('activatePreviousCertificate')
20  ->with(2000)
21  ->willReturn(new ilCertificateTemplate(
22  2000,
23  'crs',
24  'something',
25  md5('something'),
26  '[]',
27  '1',
28  'v5.4.0',
29  1234567890,
30  true,
31  'samples/background.jpg'
32  ));
33 
34  $utilHelper = $this->getMockBuilder('ilCertificateUtilHelper')
35  ->getMock();
36 
37  $utilHelper
38  ->expects($this->once())
39  ->method('convertImage');
40 
41  $objectHelper = $this->getMockBuilder('ilCertificateObjectHelper')
42  ->getMock();
43 
44  $objectHelper->method('lookUpType')
45  ->willReturn('crs');
46 
48  $templateRepositoryMock,
49  __DIR__,
50  $utilHelper,
51  $objectHelper,
52  'v5.4.0'
53  );
54 
55  $action->delete(100, 2000);
56  }
57 
59  {
60  $templateRepositoryMock = $this->getMockBuilder('ilCertificateTemplateRepository')
61  ->disableOriginalConstructor()
62  ->getMock();
63 
64  $templateRepositoryMock
65  ->method('deleteTemplate')
66  ->with(100, 2000);
67 
68  $templateRepositoryMock->method('activatePreviousCertificate')
69  ->with(2000)
70  ->willReturn(new ilCertificateTemplate(
71  2000,
72  'crs',
73  'something',
74  md5('something'),
75  '[]',
76  '1',
77  'v5.4.0',
78  1234567890,
79  true
80  ));
81 
82  $utilHelper = $this->getMockBuilder('ilCertificateUtilHelper')
83  ->getMock();
84 
85  $utilHelper
86  ->expects($this->once())
87  ->method('convertImage');
88 
89  $objectHelper = $this->getMockBuilder('ilCertificateObjectHelper')
90  ->getMock();
91 
92  $objectHelper->method('lookUpType')
93  ->willReturn('crs');
94 
96  $templateRepositoryMock,
97  __DIR__,
98  $utilHelper,
99  $objectHelper,
100  'v5.4.0'
101  );
102 
103  $action->delete(100, 2000);
104  }
105 }
$action
once($eventName, callable $callBack, $priority=100)
Subscribe to an event exactly once.