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

Public Member Functions

 setUp ()
 
 testImplementsFactoryInterface ()
 
 testRendering ()
 
 testCommonRendering ()
 
 testProducesNullWhenNoDataExists ()
 

Private Attributes

DefNamesource $name_source
 

Detailed Description

Definition at line 33 of file LinkInputTest.php.

Member Function Documentation

◆ setUp()

LinkInputTest::setUp ( )

Definition at line 39 of file LinkInputTest.php.

39  : void
40  {
41  $this->name_source = new DefNamesource();
42  }

◆ testCommonRendering()

LinkInputTest::testCommonRendering ( )

Definition at line 87 of file LinkInputTest.php.

References Vendor\Package\$f, and null.

87  : void
88  {
89  $f = $this->getFieldFactory();
90  $label = "label";
91  $link = $f->link($label, null)->withNameFrom($this->name_source);
92 
93  $this->testWithError($link);
94  $this->testWithNoByline($link);
95  $this->testWithRequired($link);
96  $this->testWithDisabled($link);
97  $this->testWithAdditionalOnloadCodeRendersId($link);
98  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

◆ testImplementsFactoryInterface()

LinkInputTest::testImplementsFactoryInterface ( )

Definition at line 44 of file LinkInputTest.php.

References $url.

44  : void
45  {
46  $factory = $this->getFieldFactory();
47  $url = $factory->link("Test Label", "Test Byline");
48 
49  $this->assertInstanceOf(Field\Link::class, $url);
50  }
$url
Definition: shib_logout.php:66

◆ testProducesNullWhenNoDataExists()

LinkInputTest::testProducesNullWhenNoDataExists ( )

Definition at line 100 of file LinkInputTest.php.

References Vendor\Package\$f, and ILIAS\GlobalScreen\has().

100  : void
101  {
102  $f = $this->getFieldFactory();
103  $input = $f->link("", "")
104  ->withNameFrom(new class () implements NameSource {
105  public function getNewName(): string
106  {
107  return "name";
108  }
109  public function getNewDedicatedName(): string
110  {
111  return "dedicated_name";
112  }
113  });
114  $input = $input->withInput(new class () implements InputData {
115  public function getOr($_, $default): string
116  {
117  return "";
118  }
119  public function get($_): string
120  {
121  return "";
122  }
123  public function has($name): bool
124  {
125  return true;
126  }
127 
128  });
129  $result = $input->getContent();
130 
131  $this->assertNull($result->value());
132  }
Describes how Input-Elements want to interact with posted data.
Definition: InputData.php:29
has(string $class_name)
Describes a source for input names.
Definition: NameSource.php:26
+ Here is the call graph for this function:

◆ testRendering()

LinkInputTest::testRendering ( )

Definition at line 52 of file LinkInputTest.php.

References null.

52  : void
53  {
54  $factory = $this->getFieldFactory();
55  $label = "Test Label";
56  $byline = "Test Byline";
57  $link = $factory->link($label, $byline)->withNameFrom($this->name_source);
58 
59  $f1 = $this->getFormWrappedHtml(
60  'text-field-input',
61  '',
62  '<input id="id_1" type="text" name="name_0/label_1" class="c-field-text" />',
63  null,
64  'id_1',
65  null,
66  'name_0/label_1'
67  );
68  $f2 = $this->getFormWrappedHtml(
69  'url-field-input',
70  '',
71  '<input id="id_2" type="url" name="name_0/url_2" class="c-field-url" />',
72  null,
73  'id_2',
74  null,
75  'name_0/url_2'
76  );
77 
78  $expected = $this->getFormWrappedHtml(
79  'link-field-input',
80  $label,
81  $f1 . $f2,
82  $byline
83  );
84  $this->assertEquals($expected, $this->render($link));
85  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

Field Documentation

◆ $name_source

DefNamesource LinkInputTest::$name_source
private

Definition at line 37 of file LinkInputTest.php.


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