ILIAS  trunk Revision v11.0_alpha-1744-gb0451eebef4
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
SectionInputTest Class Reference
+ Inheritance diagram for SectionInputTest:
+ Collaboration diagram for SectionInputTest:

Public Member Functions

 setUp ()
 
 testSectionRendering ()
 
 testCommonRendering ()
 
 testNestedSectionRendering ()
 

Protected Attributes

DefNamesource $name_source
 

Detailed Description

Definition at line 28 of file SectionInputTest.php.

Member Function Documentation

◆ setUp()

SectionInputTest::setUp ( )

Definition at line 34 of file SectionInputTest.php.

34  : void
35  {
36  $this->name_source = new DefNamesource();
37  }

◆ testCommonRendering()

SectionInputTest::testCommonRendering ( )

Definition at line 78 of file SectionInputTest.php.

References Vendor\Package\$f, and ILIAS\UI\Implementation\Component\Input\$inputs.

78  : void
79  {
80  $f = $this->getFieldFactory();
81  $inputs = [
82  $f->text("input1")
83  ];
84  $label = 'section label';
85  $section = $f->section($inputs, $label)->withNameFrom($this->name_source);
86 
87  $this->testWithError($section);
88  $this->testWithNoByline($section);
89  $this->testWithRequired($section);
90  $this->testWithDisabled($section);
91  $this->testWithAdditionalOnloadCodeRendersId($section);
92  }

◆ testNestedSectionRendering()

SectionInputTest::testNestedSectionRendering ( )

Definition at line 94 of file SectionInputTest.php.

References Vendor\Package\$f.

94  : void
95  {
96  $f = $this->getFieldFactory();
97  $inputs_level4 = [$f->text("input3", "input3 byline")];
98  $section_level4 = $f->section($inputs_level4, "Inner Section");
99 
100  $inputs_level3 = [$f->text("input2", "input2 byline"), $section_level4];
101  $section_level3 = $f->section($inputs_level3, "Middle Section");
102 
103  $inputs_level2 = [$f->text("input1", "input1 byline"), $section_level3];
104  $section_level2 = $f->section($inputs_level2, "Outermost Section");
105 
106  $nested_sections_html = $this->render($section_level2);
107 
108  $this->assertStringContainsString('<h2>Outermost Section</h2>', $nested_sections_html);
109  $this->assertStringContainsString('<h3>Middle Section</h3>', $nested_sections_html);
110  $this->assertStringContainsString('<h4>Inner Section</h4>', $nested_sections_html);
111  }

◆ testSectionRendering()

SectionInputTest::testSectionRendering ( )

Definition at line 39 of file SectionInputTest.php.

References Vendor\Package\$f, ILIAS\UI\Implementation\Component\Input\$inputs, and null.

39  : void
40  {
41  $f = $this->getFieldFactory();
42  $inputs = [
43  $f->text("input1", "in 1"),
44  $f->text("input2", "in 2")
45  ];
46  $label = 'section label';
47  $byline = 'section byline';
48  $section = $f->section($inputs, $label, $byline)->withNameFrom($this->name_source);
49  $f1 = $this->getFormWrappedHtml(
50  'text-field-input',
51  'input1',
52  '<input id="id_1" type="text" name="name_0/name_1" class="c-field-text" />',
53  'in 1',
54  'id_1',
55  null,
56  'name_0/name_1'
57  );
58  $f2 = $this->getFormWrappedHtml(
59  'text-field-input',
60  'input2',
61  '<input id="id_2" type="text" name="name_0/name_2" class="c-field-text" />',
62  'in 2',
63  'id_2',
64  null,
65  'name_0/name_2'
66  );
67  $expected = $this->getFormWrappedHtml(
68  'section-field-input',
69  $label,
70  $f1 . $f2,
71  $byline,
72  ''
73  );
74  $this->assertEquals($expected, $this->render($section));
75  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

Field Documentation

◆ $name_source

DefNamesource SectionInputTest::$name_source
protected

Definition at line 32 of file SectionInputTest.php.


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