ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 '/some/where/background.jpg',
58 '/some/where/card_tile_image.jpg',
59 '-',
60 '-',
61 null
62 ),
64 20,
65 'crs',
66 '<xml> Some Content </xml>',
67 md5('<xml> Some Content </xml>'),
68 '[]',
69 3,
70 'v5.3.0',
71 123_456_789,
72 true,
73 '/some/where/background.jpg',
74 '/some/where/card_tile_image.jpg',
75 '-',
76 '-',
77 null
78 ),
80 30,
81 'crs',
82 '<xml> Some Content </xml>',
83 md5('<xml> Some Content </xml>'),
84 '[]',
85 3,
86 'v5.3.0',
87 123_456_789,
88 true,
89 '/certificates/default/background.jpg',
90 '/some/where/card_tile_image.jpg',
91 '-',
92 '-',
93 null
94 )
95 ]
96 );
97
98 $templateRepository
99 ->expects($this->exactly(3))
100 ->method('save');
101
102 $objectHelper = $this->getMockBuilder(ilCertificateObjectHelper::class)
103 ->getMock();
104
105 $objectHelper->method('lookupObjId')
106 ->willReturn(1000);
107
108 $global_certificate_settings = $this->getMockBuilder(ilObjCertificateSettings::class)
109 ->disableOriginalConstructor()
110 ->getMock();
111
112 $cloneAction = new ilCertificateCloneAction(
113 $database,
115 $templateRepository,
116 $objectHelper,
117 $global_certificate_settings
118 );
119
120 $oldObject = $this->getMockBuilder(ilObject::class)
121 ->disableOriginalConstructor()
122 ->getMock();
123
124 $oldObject->method('getType')
125 ->willReturn('crs');
126
127 $oldObject->method('getId')
128 ->willReturn(10);
129
130 $newObject = $this->getMockBuilder(ilObject::class)
131 ->disableOriginalConstructor()
132 ->getMock();
133
134 $newObject->method('getType')
135 ->willReturn('crs');
136
137 $newObject->method('getId')
138 ->willReturn(10);
139
140 $cloneAction->cloneCertificate($oldObject, $newObject, 'v5.4.0', '/some/web/dir');
141 }

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