5 require_once(__DIR__ .
"/../../../../../libs/composer/vendor/autoload.php");
6 require_once(__DIR__ .
"/../../../Base.php");
7 require_once(__DIR__ .
"/InputTest.php");
47 $df =
new Data\Factory();
48 $language = $this->createMock(\ilLanguage::class);
61 return new class implements Field\UploadHandler {
62 public function getFileIdentifierParameterName() :
string 68 public function getUploadURL() :
string 74 public function getFileRemovalURL() :
string 83 public function getExistingFileInfoURL() :
string 92 public function getInfoForExistingFiles(array $file_ids) : array
102 $f = $this->buildFactory();
104 $text =
$f->file($this->getUploadHandler(),
"label",
"byline");
106 $this->assertInstanceOf(Field\Input::class, $text);
107 $this->assertInstanceOf(Field\File::class, $text);
113 $f = $this->buildFactory();
117 $text =
$f->file($this->getUploadHandler(), $label, $byline)->withNameFrom($this->name_source);
119 $r = $this->getDefaultRenderer();
120 $html = $this->brutallyTrimHTML($r->render($text));
122 $expected = $this->brutallyTrimHTML(
' 123 <div class="form-group row"> 124 <label for="id_1" class="control-label col-sm-3">label</label> 125 <div class="col-sm-9"> 126 <div class="il-input-file" id="id_1"> 127 <div class="il-input-file-dropzone"> <button class="btn btn-link" data-action="#" id="id_2">select_files_from_computer</button></div> 128 <div class="il-input-file-filelist"> 129 <div class="il-input-file-template dz-preview dz-file-preview" style="display: block; border: 1px solid red;" data-file-id=""> 130 <div class="dz-details"> 131 <div class="il-input-file-fileinfo"> 132 <div class="il-input-file-fileinfo-title"><span data-dz-name></span></div> 133 <div data-dz-size class="il-input-file-fileinfo-size"></div> 134 <div class="il-input-file-fileinfo-close"> <button type="button" class="close" data-dz-remove> <span aria-hidden="true">×</span> <span class="sr-only">Close</span> </button> </div> 136 <!-- <div class="dz-progress"><span class="dz-upload" data-dz-uploadprogress></span></div>--> <!-- <div class="dz-success-mark"><span>✔</span></div>--> <!-- <div class="dz-error-mark"><span>✘</span></div>--> 137 <div class="dz-error-message il-input-file-error"><span data-dz-errormessage></span></div> 141 <input class="input-template" type="hidden" name="name_0[]" value="" data-file-id="" /> 143 <div class="help-block">byline</div> 147 $this->assertEquals($expected, $html);
153 $f = $this->buildFactory();
158 $text =
$f->file($this->getUploadHandler(), $label, $byline)->withNameFrom($this->name_source)->withError($error);
160 $r = $this->getDefaultRenderer();
161 $html = $this->brutallyTrimHTML($r->render($text));
163 $expected = $this->brutallyTrimHTML(
' 164 <div class="form-group row"> 165 <label for="id_1" class="control-label col-sm-3">label</label> 166 <div class="col-sm-9"> 167 <div class="help-block alert alert-danger" role="alert">an_error</div> 168 <div class="il-input-file" id="id_1"> 169 <div class="il-input-file-dropzone"><button class="btn btn-link" data-action="#" id="id_2">select_files_from_computer</button></div> 170 <div class="il-input-file-filelist"> 171 <div class="il-input-file-template dz-preview dz-file-preview" style="display: block; border: 1px solid red;" data-file-id=""> 172 <div class="dz-details"> 173 <div class="il-input-file-fileinfo"> 174 <div class="il-input-file-fileinfo-title"><span data-dz-name></span></div> 175 <div data-dz-size class="il-input-file-fileinfo-size"></div> 176 <div class="il-input-file-fileinfo-close"> 177 <button type="button" class="close" data-dz-remove><span aria-hidden="true">×</span> <span class="sr-only">Close</span></button> 180 <!-- <div class="dz-progress"><span class="dz-upload" data-dz-uploadprogress></span></div>--> 181 <!-- <div class="dz-success-mark"><span>✔</span></div>--> 182 <!-- <div class="dz-error-mark"><span>✘</span></div>--> 183 <div class="dz-error-message il-input-file-error"><span data-dz-errormessage></span></div> 187 <input class="input-template" type="hidden" name="name_0[]" value="" data-file-id="" /> 189 <div class="help-block">byline</div> 193 $this->assertEquals($expected, $html);
199 $f = $this->buildFactory();
202 $text =
$f->file($this->getUploadHandler(), $label)->withNameFrom($this->name_source);
204 $r = $this->getDefaultRenderer();
205 $html = $this->brutallyTrimHTML($r->render($text));
207 $expected = $this->brutallyTrimHTML(
' 208 <div class="form-group row"> 209 <label for="id_1" class="control-label col-sm-3">label</label> 210 <div class="col-sm-9"> 211 <div class="il-input-file" id="id_1"> 212 <div class="il-input-file-dropzone"><button class="btn btn-link" data-action="#" id="id_2">select_files_from_computer</button></div> 213 <div class="il-input-file-filelist"> 214 <div class="il-input-file-template dz-preview dz-file-preview" style="display: block; border: 1px solid red;" data-file-id=""> 215 <div class="dz-details"> 216 <div class="il-input-file-fileinfo"> 217 <div class="il-input-file-fileinfo-title"><span data-dz-name></span></div> 218 <div data-dz-size class="il-input-file-fileinfo-size"></div> 219 <div class="il-input-file-fileinfo-close"> 220 <button type="button" class="close" data-dz-remove><span aria-hidden="true">×</span> <span class="sr-only">Close</span></button> 223 <!-- <div class="dz-progress"><span class="dz-upload" data-dz-uploadprogress></span></div>--> 224 <!-- <div class="dz-success-mark"><span>✔</span></div>--> 225 <!-- <div class="dz-error-mark"><span>✘</span></div>--> 226 <div class="dz-error-message il-input-file-error"><span data-dz-errormessage></span></div> 230 <input class="input-template" type="hidden" name="name_0[]" value="" data-file-id="" /> 235 $this->assertEquals($expected, $html);
241 $f = $this->buildFactory();
245 $text =
$f->file($this->getUploadHandler(), $label)->withValue($value)->withNameFrom($this->name_source);
247 $r = $this->getDefaultRenderer();
248 $html = $this->brutallyTrimHTML($r->render($text));
250 $expected = $this->brutallyTrimHTML(
' 251 <div class="form-group row"> 252 <label for="id_1" class="control-label col-sm-3">label</label> 253 <div class="col-sm-9"> 254 <div class="il-input-file" id="id_1"> 255 <div class="il-input-file-dropzone"><button class="btn btn-link" data-action="#" id="id_2">select_files_from_computer</button></div> 256 <div class="il-input-file-filelist"> 257 <div class="il-input-file-template dz-preview dz-file-preview" style="display: block; border: 1px solid red;" data-file-id=""> 258 <div class="dz-details"> 259 <div class="il-input-file-fileinfo"> 260 <div class="il-input-file-fileinfo-title"><span data-dz-name></span></div> 261 <div data-dz-size class="il-input-file-fileinfo-size"></div> 262 <div class="il-input-file-fileinfo-close"> 263 <button type="button" class="close" data-dz-remove><span aria-hidden="true">×</span> <span class="sr-only">Close</span></button> 266 <!-- <div class="dz-progress"><span class="dz-upload" data-dz-uploadprogress></span></div>--> 267 <!-- <div class="dz-success-mark"><span>✔</span></div>--> 268 <!-- <div class="dz-error-mark"><span>✘</span></div>--> 269 <div class="dz-error-message il-input-file-error"><span data-dz-errormessage></span></div> 273 <input class="input-template" type="hidden" name="name_0[]" value="" data-file-id="" /> 278 $this->assertEquals($expected, $html);
284 $f = $this->buildFactory();
286 $text =
$f->file($this->getUploadHandler(), $label)->withNameFrom($this->name_source)->withRequired(
true);
288 $r = $this->getDefaultRenderer();
289 $html = $this->brutallyTrimHTML($r->render($text));
291 $expected = $this->brutallyTrimHTML(
' 292 <div class="form-group row"> 293 <label for="id_1" class="control-label col-sm-3">label<span class="asterisk">*</span></label> 294 <div class="col-sm-9"> 295 <div class="il-input-file" id="id_1"> 296 <div class="il-input-file-dropzone"><button class="btn btn-link" data-action="#" id="id_2">select_files_from_computer</button></div> 297 <div class="il-input-file-filelist"> 298 <div class="il-input-file-template dz-preview dz-file-preview" style="display: block; border: 1px solid red;" data-file-id=""> 299 <div class="dz-details"> 300 <div class="il-input-file-fileinfo"> 301 <div class="il-input-file-fileinfo-title"><span data-dz-name></span></div> 302 <div data-dz-size class="il-input-file-fileinfo-size"></div> 303 <div class="il-input-file-fileinfo-close"> 304 <button type="button" class="close" data-dz-remove><span aria-hidden="true">×</span> <span class="sr-only">Close</span></button> 307 <!-- <div class="dz-progress"><span class="dz-upload" data-dz-uploadprogress></span></div>--> 308 <!-- <div class="dz-success-mark"><span>✔</span></div>--> 309 <!-- <div class="dz-error-mark"><span>✘</span></div>--> 310 <div class="dz-error-message il-input-file-error"><span data-dz-errormessage></span></div> 314 <input class="input-template" type="hidden" name="name_0[]" value="" data-file-id="" /> 319 $this->assertEquals($expected, $html);
325 $f = $this->buildFactory();
327 $text =
$f->file($this->getUploadHandler(), $label)->withNameFrom($this->name_source)->withDisabled(
true);
329 $r = $this->getDefaultRenderer();
330 $html = $this->brutallyTrimHTML($r->render($text));
332 $expected = $this->brutallyTrimHTML(
' 333 <div class="form-group row"> 334 <label for="id_1" class="control-label col-sm-3">label</label> 335 <div class="col-sm-9"> 336 <div class="il-input-file" id="id_1"> 337 <div class="il-input-file-dropzone"><button class="btn btn-link" data-action="#" id="id_2">select_files_from_computer</button></div> 338 <div class="il-input-file-filelist"> 339 <div class="il-input-file-template dz-preview dz-file-preview" style="display: block; border: 1px solid red;" data-file-id=""> 340 <div class="dz-details"> 341 <div class="il-input-file-fileinfo"> 342 <div class="il-input-file-fileinfo-title"><span data-dz-name></span></div> 343 <div data-dz-size class="il-input-file-fileinfo-size"></div> 344 <div class="il-input-file-fileinfo-close"> 345 <button type="button" class="close" data-dz-remove><span aria-hidden="true">×</span> <span class="sr-only">Close</span></button> 348 <!-- <div class="dz-progress"><span class="dz-upload" data-dz-uploadprogress></span></div>--> 349 <!-- <div class="dz-success-mark"><span>✔</span></div>--> 350 <!-- <div class="dz-error-mark"><span>✘</span></div>--> 351 <div class="dz-error-message il-input-file-error"><span data-dz-errormessage></span></div> 355 <input class="input-template" type="hidden" name="name_0[]" value="" data-file-id="" /> 361 $this->assertEquals($expected, $html);
377 $ui_factory = $this->getUIFactory();
378 $tpl_factory = $this->getTemplateFactory();
379 $resource_registry = $this->getResourceRegistry();
380 $lng = $this->getLanguage();
382 $js_binding = $this->getJavaScriptBinding();
385 $refinery = $this->getRefinery();
388 $component_renderer_loader
Loads renderers for components from the file system.
Class ChatMainBarProvider .
Caches renderers loaded by another loader.
Registers resources for retreived renderers at a ResourceRegistry.
Provides common functionality for UI tests.
Provides methods to interface with javascript.