ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
ilCertificateCloneActionTest Class Reference
+ Inheritance diagram for ilCertificateCloneActionTest:
+ Collaboration diagram for ilCertificateCloneActionTest:

Public Member Functions

 testCloneCertificate ()
 

Additional Inherited Members

- Protected Member Functions inherited from ilCertificateBaseTestCase
 setUp ()
 
 tearDown ()
 
 assertDoesNotThrow (callable $cb, string $message='')
 
 assertThrows (callable $cb, ?string $expected_class=null, ?string $expected_message=null)
 @template T of Throwable More...
 
 setGlobalVariable (string $name, mixed $value)
 
- Protected Attributes inherited from ilCertificateBaseTestCase
Container $dic
 

Detailed Description

Definition at line 21 of file ilCertificateCloneActionTest.php.

Member Function Documentation

◆ testCloneCertificate()

ilCertificateCloneActionTest::testCloneCertificate ( )

Definition at line 23 of file ilCertificateCloneActionTest.php.

23 : void
24 {
25 $database = $this->createMock(ilDBInterface::class);
26
27 $database
28 ->expects($this->once())
29 ->method('query');
30
31 $database
32 ->expects($this->once())
33 ->method('fetchAssoc')
34 ->willReturn(['1' => '1']);
35
36 $database
37 ->expects($this->once())
38 ->method('replace');
39
40
41
42 $templateRepository = $this->getMockBuilder(ilCertificateTemplateRepository::class)->getMock();
43
44 $templateRepository->method('fetchCertificateTemplatesByObjId')
45 ->willReturn(
46 [
48 10,
49 'crs',
50 '<xml> Some Content </xml>',
51 md5('<xml> Some Content </xml>'),
52 '[]',
53 3,
54 'v5.3.0',
55 123_456_789,
56 true,
57 '-',
58 '-',
59 null
60 ),
62 20,
63 'crs',
64 '<xml> Some Content </xml>',
65 md5('<xml> Some Content </xml>'),
66 '[]',
67 3,
68 'v5.3.0',
69 123_456_789,
70 true,
71 '-',
72 '-',
73 null
74 ),
76 30,
77 'crs',
78 '<xml> Some Content </xml>',
79 md5('<xml> Some Content </xml>'),
80 '[]',
81 3,
82 'v5.3.0',
83 123_456_789,
84 true,
85 '-',
86 '-',
87 null
88 )
89 ]
90 );
91
92 $templateRepository
93 ->expects($this->exactly(3))
94 ->method('save');
95
96 $objectHelper = $this->getMockBuilder(ilCertificateObjectHelper::class)
97 ->getMock();
98
99 $objectHelper->method('lookupObjId')
100 ->willReturn(1000);
101
102 $global_certificate_settings = $this->getMockBuilder(ilObjCertificateSettings::class)
103 ->disableOriginalConstructor()
104 ->getMock();
105
106 $cloneAction = new ilCertificateCloneAction(
107 $database,
109 $templateRepository,
110 $objectHelper,
111 $global_certificate_settings
112 );
113
114 $oldObject = $this->getMockBuilder(ilObject::class)
115 ->disableOriginalConstructor()
116 ->getMock();
117
118 $oldObject->method('getType')
119 ->willReturn('crs');
120
121 $oldObject->method('getId')
122 ->willReturn(10);
123
124 $newObject = $this->getMockBuilder(ilObject::class)
125 ->disableOriginalConstructor()
126 ->getMock();
127
128 $newObject->method('getType')
129 ->willReturn('crs');
130
131 $newObject->method('getId')
132 ->willReturn(10);
133
134 $cloneAction->cloneCertificate($oldObject, $newObject, 'v5.4.0', '/some/web/dir');
135 }

The documentation for this class was generated from the following file: