ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
ilCertificateSettingsTestFormRepositoryTest.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 {
9  public function testCreate()
10  {
11  $object = $this->getMockBuilder('ilObjTest')
12  ->disableOriginalConstructor()
13  ->getMock();
14 
15  $formMock = $this->getMockBuilder('ilPropertyFormGUI')
16  ->disableOriginalConstructor()
17  ->getMock();
18 
19  $language = $this->getMockBuilder('ilLanguage')
20  ->disableOriginalConstructor()
21  ->getMock();
22 
23  $controller = $this->getMockBuilder('ilCtrl')
24  ->disableOriginalConstructor()
25  ->getMock();
26 
27  $access = $this->getMockBuilder('ilAccess')
28  ->disableOriginalConstructor()
29  ->getMock();
30 
31  $toolbar = $this->getMockBuilder('ilToolbarGUI')
32  ->disableOriginalConstructor()
33  ->getMock();
34 
35  $placeholderDescriptionObject = $this->getMockBuilder('ilCertificatePlaceholderDescription')
36  ->disableOriginalConstructor()
37  ->getMock();
38 
39  $settingsFormFactory = $this->getMockBuilder('ilCertificateSettingsFormRepository')
40  ->disableOriginalConstructor()
41  ->getMock();
42 
43  $settingsFormFactory
44  ->expects($this->once())
45  ->method('createForm')
46  ->willReturn($formMock);
47 
49  100,
50  '/some/where/',
51  false,
52  $object,
53  $language,
54  $controller,
55  $access,
56  $toolbar,
57  $placeholderDescriptionObject,
58  $settingsFormFactory
59  );
60 
61  $guiMock = $this->getMockBuilder('ilCertificateGUI')
62  ->disableOriginalConstructor()
63  ->getMock();
64 
65  $certificateMock = $this->getMockBuilder('ilCertificate')
66  ->disableOriginalConstructor()
67  ->getMock();
68 
69  $result = $repository->createForm($guiMock, $certificateMock);
70 
71  $this->assertEquals($formMock, $result);
72  }
73 
77  public function testSave()
78  {
79  $object = $this->getMockBuilder('ilObjTest')
80  ->disableOriginalConstructor()
81  ->getMock();
82 
83  $object
84  ->method('getId')
85  ->willReturn(100);
86 
87  $language = $this->getMockBuilder('ilLanguage')
88  ->disableOriginalConstructor()
89  ->getMock();
90 
91  $controller = $this->getMockBuilder('ilCtrl')
92  ->disableOriginalConstructor()
93  ->getMock();
94 
95  $access = $this->getMockBuilder('ilAccess')
96  ->disableOriginalConstructor()
97  ->getMock();
98 
99  $toolbar = $this->getMockBuilder('ilToolbarGUI')
100  ->disableOriginalConstructor()
101  ->getMock();
102 
103  $placeholderDescriptionObject = $this->getMockBuilder('ilCertificatePlaceholderDescription')
104  ->disableOriginalConstructor()
105  ->getMock();
106 
107  $settingsFormFactory = $this->getMockBuilder('ilCertificateSettingsFormRepository')
108  ->disableOriginalConstructor()
109  ->getMock();
110 
111  $repository = new ilCertificateSettingsTestFormRepository(
112  100,
113  '/some/where/',
114  false,
115  $object,
116  $language,
117  $controller,
118  $access,
119  $toolbar,
120  $placeholderDescriptionObject,
121  $settingsFormFactory
122  );
123 
124  $repository->save(array(1, 2, 3));
125  }
126 
127  public function testFormFieldData()
128  {
129  $object = $this->getMockBuilder('ilObjTest')
130  ->disableOriginalConstructor()
131  ->getMock();
132 
133  $object
134  ->method('getId')
135  ->willReturn(100);
136 
137  $language = $this->getMockBuilder('ilLanguage')
138  ->disableOriginalConstructor()
139  ->getMock();
140 
141  $controller = $this->getMockBuilder('ilCtrl')
142  ->disableOriginalConstructor()
143  ->getMock();
144 
145  $access = $this->getMockBuilder('ilAccess')
146  ->disableOriginalConstructor()
147  ->getMock();
148 
149  $toolbar = $this->getMockBuilder('ilToolbarGUI')
150  ->disableOriginalConstructor()
151  ->getMock();
152 
153  $placeholderDescriptionObject = $this->getMockBuilder('ilCertificatePlaceholderDescription')
154  ->disableOriginalConstructor()
155  ->getMock();
156 
157  $settingsFormFactory = $this->getMockBuilder('ilCertificateSettingsFormRepository')
158  ->disableOriginalConstructor()
159  ->getMock();
160 
161  $settingsFormFactory
162  ->expects($this->once())
163  ->method('fetchFormFieldData')
164  ->willReturn(array('something' => 'value'));
165 
166  $repository = new ilCertificateSettingsTestFormRepository(
167  100,
168  '/some/where/',
169  false,
170  $object,
171  $language,
172  $controller,
173  $access,
174  $toolbar,
175  $placeholderDescriptionObject,
176  $settingsFormFactory
177  );
178 
179  $result = $repository->fetchFormFieldData('SomeContent');
180 
181  $this->assertEquals(array('something' => 'value'), $result);
182  }
183 }
$result
Class ilCertificateBaseTestCase.