ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
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 ()
 
 setGlobalVariable (string $name, $value)
 

Detailed Description

Member Function Documentation

◆ testCloneCertificate()

ilCertificateCloneActionTest::testCloneCertificate ( )

Definition at line 26 of file ilCertificateCloneActionTest.php.

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

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