ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
FieldFactoryTest.php
Go to the documentation of this file.
1<?php
2
3require_once 'tests/UI/AbstractFactoryTest.php';
4
5use \ILIAS\UI\Component\Input\Field;
7use \ILIAS\Data;
8use \ILIAS\Validation;
9use \ILIAS\Transformation;
10
12{
14 "text" => array(
15 "context" => false,
16 ),
17 "numeric" => array(
18 "context" => false,
19 ),
20 "group" => array(
21 "context" => false,
22 ),
23 "section" => array(
24 "context" => false,
25 ),
26 "dependantGroup" => array(
27 "context" => false,
28 ),
29 "checkbox" => array(
30 "context" => false,
31 ),
32 "select" => array(
33 "context" => false,
34 ),
35 "textarea" => array(
36 "context" => false,
37 ),
38 "radio" => array(
39 "context" => false,
40 ),
41 "multiSelect" => array(
42 "context" => false,
43 )
44 );
45 public $factory_title = 'ILIAS\\UI\\Component\\Input\\Field\\Factory';
46
47
48 final public function buildFactory()
49 {
50 $df = new Data\Factory();
51 return new \ILIAS\UI\Implementation\Component\Input\Field\Factory(
52 new SignalGenerator(),
53 $df,
54 new Validation\Factory($df, $this->createMock(\ilLanguage::class)),
56 );
57 }
58
59
61 {
62 $f = $this->buildFactory();
63
64 $text = $f->text("label", "byline");
65 $this->assertInstanceOf(Field\Input::class, $text);
66 $this->assertInstanceOf(Field\Text::class, $text);
67
68 $text = $f->numeric("label", "byline");
69 $this->assertInstanceOf(Field\Input::class, $text);
70 $this->assertInstanceOf(Field\Numeric::class, $text);
71
72 $text = $f->section([], "label", "byline");
73 $this->assertInstanceOf(Field\Input::class, $text);
74 $this->assertInstanceOf(Field\Group::class, $text);
75 $this->assertInstanceOf(Field\Section::class, $text);
76
77 $text = $f->group([]);
78 $this->assertInstanceOf(Field\Input::class, $text);
79 $this->assertInstanceOf(Field\Group::class, $text);
80 }
81}
Defines tests every SHOULD pass UI-factory.
An exception for terminatinating execution or to throw for unit testing.
Builds data types.
Definition: Factory.php:15
A transformation is a function from one datatype to another.
$text
Definition: errorreport.php:18