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->normalizeHTML($r->render($text));
123 =
'<div class="form-group row"> <label for="name_0" class="control-label col-sm-3">label</label> <div class="col-sm-9"> <div class="il-input-file" id="id_2"><div class="il-input-file-dropzone"> <button class="btn btn-link" data-action="#" id="id_1">select_files_from_computer</button></div><div class="il-input-file-filelist"> <div class="il-input-file-template dz-preview dz-file-preview" style="display: block; border: 1px solid red" data-file-id=""> <div class="dz-details"> <div class="il-input-file-fileinfo"> <div class="il-input-file-fileinfo-title"><span data-dz-name></span></div> <div data-dz-size class="il-input-file-fileinfo-size"></div> <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> </div> <!-- <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>--> <div class="dz-error-message il-input-file-error"><span data-dz-errormessage></span></div> </div> </div></div><input class="input-template" type="hidden" name="name_0[]" value="" data-file-id=""></div> <div class="help-block">byline</div> </div></div>';
124 $this->assertEquals($expected, $html);
130 $f = $this->buildFactory();
135 $text =
$f->file($this->getUploadHandler(), $label, $byline)->withNameFrom($this->name_source)->withError($error);
137 $r = $this->getDefaultRenderer();
138 $html = $this->normalizeHTML($r->render($text));
141 =
'<div class="form-group row"> <label for="name_0" class="control-label col-sm-3">label</label> <div class="col-sm-9"> <div class="il-input-file" id="id_2"><div class="il-input-file-dropzone"> <button class="btn btn-link" data-action="#" id="id_1">select_files_from_computer</button></div><div class="il-input-file-filelist"> <div class="il-input-file-template dz-preview dz-file-preview" style="display: block; border: 1px solid red" data-file-id=""> <div class="dz-details"> <div class="il-input-file-fileinfo"> <div class="il-input-file-fileinfo-title"><span data-dz-name></span></div> <div data-dz-size class="il-input-file-fileinfo-size"></div> <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> </div> <!-- <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>--> <div class="dz-error-message il-input-file-error"><span data-dz-errormessage></span></div> </div> </div></div><input class="input-template" type="hidden" name="name_0[]" value="" data-file-id=""></div> <div class="help-block">byline</div> <div class="help-block alert alert-danger" role="alert"> <img border="0" src="./templates/default/images/icon_alert.svg" alt="alert" /> an_error </div> </div></div>';
142 $this->assertEquals($expected, $html);
148 $f = $this->buildFactory();
151 $text =
$f->file($this->getUploadHandler(), $label)->withNameFrom($this->name_source);
153 $r = $this->getDefaultRenderer();
154 $html = $this->normalizeHTML($r->render($text));
157 =
'<div class="form-group row"> <label for="name_0" class="control-label col-sm-3">label</label> <div class="col-sm-9"> <div class="il-input-file" id="id_2"><div class="il-input-file-dropzone"> <button class="btn btn-link" data-action="#" id="id_1">select_files_from_computer</button></div><div class="il-input-file-filelist"> <div class="il-input-file-template dz-preview dz-file-preview" style="display: block; border: 1px solid red" data-file-id=""> <div class="dz-details"> <div class="il-input-file-fileinfo"> <div class="il-input-file-fileinfo-title"><span data-dz-name></span></div> <div data-dz-size class="il-input-file-fileinfo-size"></div> <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> </div> <!-- <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>--> <div class="dz-error-message il-input-file-error"><span data-dz-errormessage></span></div> </div> </div></div><input class="input-template" type="hidden" name="name_0[]" value="" data-file-id=""></div> </div></div>';
158 $this->assertEquals($expected, $html);
164 $f = $this->buildFactory();
168 $text =
$f->file($this->getUploadHandler(), $label)->withValue($value)->withNameFrom($this->name_source);
170 $r = $this->getDefaultRenderer();
171 $html = $this->normalizeHTML($r->render($text));
174 =
'<div class="form-group row"> <label for="name_0" class="control-label col-sm-3">label</label> <div class="col-sm-9"> <div class="il-input-file" id="id_2"><div class="il-input-file-dropzone"> <button class="btn btn-link" data-action="#" id="id_1">select_files_from_computer</button></div><div class="il-input-file-filelist"> <div class="il-input-file-template dz-preview dz-file-preview" style="display: block; border: 1px solid red" data-file-id=""> <div class="dz-details"> <div class="il-input-file-fileinfo"> <div class="il-input-file-fileinfo-title"><span data-dz-name></span></div> <div data-dz-size class="il-input-file-fileinfo-size"></div> <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> </div> <!-- <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>--> <div class="dz-error-message il-input-file-error"><span data-dz-errormessage></span></div> </div> </div></div><input class="input-template" type="hidden" name="name_0[]" value="" data-file-id=""></div> </div></div>';
175 $this->assertEquals($expected, $html);
181 $f = $this->buildFactory();
184 $text =
$f->file($this->getUploadHandler(), $label)->withNameFrom($this->name_source)->withRequired(
true);
186 $r = $this->getDefaultRenderer();
187 $html = $this->normalizeHTML($r->render($text));
190 =
'<div class="form-group row"> <label for="name_0" class="control-label col-sm-3">label<span class="asterisk">*</span></label> <div class="col-sm-9"> <div class="il-input-file" id="id_2"><div class="il-input-file-dropzone"> <button class="btn btn-link" data-action="#" id="id_1">select_files_from_computer</button></div><div class="il-input-file-filelist"> <div class="il-input-file-template dz-preview dz-file-preview" style="display: block; border: 1px solid red" data-file-id=""> <div class="dz-details"> <div class="il-input-file-fileinfo"> <div class="il-input-file-fileinfo-title"><span data-dz-name></span></div> <div data-dz-size class="il-input-file-fileinfo-size"></div> <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> </div> <!-- <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>--> <div class="dz-error-message il-input-file-error"><span data-dz-errormessage></span></div> </div> </div></div><input class="input-template" type="hidden" name="name_0[]" value="" data-file-id=""></div> </div></div>';
191 $this->assertEquals($expected, $html);
197 $f = $this->buildFactory();
200 $text =
$f->file($this->getUploadHandler(), $label)->withNameFrom($this->name_source)->withDisabled(
true);
202 $r = $this->getDefaultRenderer();
203 $html = $this->normalizeHTML($r->render($text));
206 =
'<div class="form-group row"> <label for="name_0" class="control-label col-sm-3">label</label> <div class="col-sm-9"> <div class="il-input-file" id="id_2"><div class="il-input-file-dropzone"> <button class="btn btn-link" data-action="#" id="id_1">select_files_from_computer</button></div><div class="il-input-file-filelist"> <div class="il-input-file-template dz-preview dz-file-preview" style="display: block; border: 1px solid red" data-file-id=""> <div class="dz-details"> <div class="il-input-file-fileinfo"> <div class="il-input-file-fileinfo-title"><span data-dz-name></span></div> <div data-dz-size class="il-input-file-fileinfo-size"></div> <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> </div> <!-- <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>--> <div class="dz-error-message il-input-file-error"><span data-dz-errormessage></span></div> </div> </div></div><input class="input-template" type="hidden" name="name_0[]" value="" data-file-id=""></div> </div></div>';
208 $this->assertEquals($expected, $html);
229 $ui_factory = $this->getUIFactory();
230 $tpl_factory = $this->getTemplateFactory();
231 $resource_registry = $this->getResourceRegistry();
232 $lng = $this->getLanguage();
234 $js_binding = $this->getJavaScriptBinding();
237 $refinery = $this->getRefinery();
239 $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.