ILIAS  trunk Revision v11.0_alpha-2662-g519ff7d528f
PasswordInputTest Class Reference
+ Inheritance diagram for PasswordInputTest:
+ Collaboration diagram for PasswordInputTest:

Public Member Functions

 setUp ()
 
 testImplementsFactoryInterface ()
 
 testRender ()
 
 testCommonRendering ()
 
 testRenderValue ()
 
 testValueRequired ()
 
 testValueType ()
 

Protected Attributes

DefNamesource $name_source
 

Detailed Description

Definition at line 61 of file PasswordInputTest.php.

Member Function Documentation

◆ setUp()

PasswordInputTest::setUp ( )

Definition at line 67 of file PasswordInputTest.php.

67  : void
68  {
69  $this->name_source = new DefNamesource();
70  }

◆ testCommonRendering()

PasswordInputTest::testCommonRendering ( )

Definition at line 101 of file PasswordInputTest.php.

References Vendor\Package\$f.

101  : void
102  {
103  $f = $this->getFieldFactory();
104  $label = "label";
105  $pwd = $f->password($label)->withNameFrom($this->name_source);
106 
107  $this->testWithError($pwd);
108  $this->testWithNoByline($pwd);
109  $this->testWithRequired($pwd);
110  $this->testWithDisabled($pwd);
111  $this->testWithAdditionalOnloadCodeRendersId($pwd);
112  }

◆ testImplementsFactoryInterface()

PasswordInputTest::testImplementsFactoryInterface ( )

Definition at line 72 of file PasswordInputTest.php.

References Vendor\Package\$f.

72  : void
73  {
74  $f = $this->getFieldFactory();
75  $pwd = $f->password("label", "byline");
76  $this->assertInstanceOf(\ILIAS\UI\Component\Input\Container\Form\FormInput::class, $pwd);
77  $this->assertInstanceOf(Field\Password::class, $pwd);
78  }
Interface Observer Contains several chained tasks and infos about them.

◆ testRender()

PasswordInputTest::testRender ( )

Definition at line 80 of file PasswordInputTest.php.

References Vendor\Package\$f.

80  : void
81  {
82  $f = $this->getFieldFactory();
83  $label = "label";
84  $byline = "byline";
85  $name = "name_0";
86  $pwd = $f->password($label, $byline)->withNameFrom($this->name_source);
87  $expected = $this->getFormWrappedHtml(
88  'password-field-input',
89  $label,
90  '
91  <div class="c-field-password">
92  <input id="id_1" type="password" name="' . $name . '" autocomplete="off" />
93  </div>
94  ',
95  $byline,
96  'id_1'
97  );
98  $this->assertEquals($expected, $this->render($pwd));
99  }

◆ testRenderValue()

PasswordInputTest::testRenderValue ( )

Definition at line 114 of file PasswordInputTest.php.

References Vendor\Package\$f, and null.

114  : void
115  {
116  $f = $this->getFieldFactory();
117  $label = "label";
118  $value = "value_0";
119  $name = "name_0";
120  $pwd = $f->password($label)->withValue($value)->withNameFrom($this->name_source);
121  $expected = $this->getFormWrappedHtml(
122  'password-field-input',
123  $label,
124  '
125  <div class="c-field-password">
126  <input id="id_1" type="password" name="' . $name . '" value="' . $value . '" autocomplete="off" />
127  </div>
128  ',
129  null,
130  'id_1'
131  );
132  $this->assertEquals($expected, $this->render($pwd));
133  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

◆ testValueRequired()

PasswordInputTest::testValueRequired ( )

Definition at line 135 of file PasswordInputTest.php.

References Vendor\Package\$f.

135  : void
136  {
137  $f = $this->getFieldFactory();
138  $label = "label";
139  $name = "name_0";
140  $pwd = $f->password($label)->withNameFrom($this->name_source)->withRequired(true);
141 
142  $pwd1 = $pwd->withInput(new DefInputData([$name => "0"]));
143  $value1 = $pwd1->getContent();
144  $this->assertTrue($value1->isOk());
145 
146  $pwd2 = $pwd->withInput(new DefInputData([$name => ""]));
147  $value2 = $pwd2->getContent();
148  $this->assertTrue($value2->isError());
149  }

◆ testValueType()

PasswordInputTest::testValueType ( )

Definition at line 151 of file PasswordInputTest.php.

References Vendor\Package\$f, and $post.

151  : void
152  {
153  $f = $this->getFieldFactory();
154  $label = "label";
155  $pwd = $f->password($label)->withNameFrom($this->name_source);
156  $this->assertNull($pwd->getValue());
157 
158  $post = new _PWDInputData();
159  $pwd = $pwd->withInput($post);
160  $this->assertEquals($post->getOr('', ''), $pwd->getValue());
161  $this->assertInstanceOf(PWD::class, $pwd->getContent()->value());
162  }
$post
Definition: ltitoken.php:46

Field Documentation

◆ $name_source

DefNamesource PasswordInputTest::$name_source
protected

Definition at line 65 of file PasswordInputTest.php.


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