Basic Tests for Table-Columns.
More...
Basic Tests for Table-Columns.
Definition at line 35 of file ColumnTest.php.
◆ provideColumnFormats()
static ColumnTest::provideColumnFormats |
( |
| ) |
|
|
static |
Definition at line 134 of file ColumnTest.php.
References $lng, and ILIAS\GlobalScreen\Provider\__construct().
143 'column' =>
new Column\LinkListing(
$lng,
''),
148 'column' =>
new Column\LinkListing(
$lng,
''),
153 'column' =>
new Column\LinkListing(
$lng,
''),
158 'column' =>
new Column\LinkListing(
$lng,
''),
163 'column' =>
new Column\Link(
$lng,
''),
168 'column' =>
new Column\Link(
$lng,
''),
169 'value' =>
'some string',
173 'column' =>
new Column\StatusIcon(
$lng,
''),
178 'column' =>
new Column\StatusIcon(
$lng,
''),
179 'value' =>
'some string',
This implements commonalities between Links.
__construct(Container $dic, ilPlugin $plugin)
◆ setUp()
◆ testDataTableColumnAllowedFormats()
ColumnTest::testDataTableColumnAllowedFormats |
( |
Column\Column |
$column, |
|
|
|
$value, |
|
|
bool |
$ok |
|
) |
| |
 * provideColumnFormats 
Definition at line 188 of file ColumnTest.php.
194 $this->expectException(\InvalidArgumentException::class);
196 $this->assertEquals($value, $column->format($value));
◆ testDataTableColumnBoolFormat()
ColumnTest::testDataTableColumnBoolFormat |
( |
| ) |
|
Definition at line 74 of file ColumnTest.php.
References ILIAS\Repository\lng().
76 $col =
new Column\Boolean($this->
lng,
'col',
'TRUE',
'FALSE');
77 $this->assertEquals(
'TRUE', $col->format(
true));
78 $this->assertEquals(
'FALSE', $col->format(
false));
◆ testDataTableColumnBoolFormatWithGlyph()
ColumnTest::testDataTableColumnBoolFormatWithGlyph |
( |
| ) |
|
Definition at line 90 of file ColumnTest.php.
References ILIAS\Repository\lng().
92 $ok =
new Glyph(GlyphInterface::LIKE,
'');
93 $no =
new Glyph(GlyphInterface::DISLIKE,
'');
94 $col =
new Column\Boolean($this->
lng,
'col', $ok, $no);
95 $this->assertEquals($ok, $col->format(
true));
96 $this->assertEquals($no, $col->format(
false));
This describes how a glyph could be modified during construction of UI.
◆ testDataTableColumnBoolFormatWithIcon()
ColumnTest::testDataTableColumnBoolFormatWithIcon |
( |
| ) |
|
Definition at line 81 of file ColumnTest.php.
References ILIAS\Repository\lng().
85 $col =
new Column\Boolean($this->
lng,
'col', $ok, $no);
86 $this->assertEquals($ok, $col->format(
true));
87 $this->assertEquals($no, $col->format(
false));
◆ testDataTableColumnCustomOrderingLabels()
ColumnTest::testDataTableColumnCustomOrderingLabels |
( |
| ) |
|
Definition at line 224 of file ColumnTest.php.
References ILIAS\Repository\lng().
226 $col = (
new Column\LinkListing($this->
lng,
'col'))
227 ->withIsSortable(
true)
228 ->withOrderingLabels(
237 $col->getOrderingLabels()
◆ testDataTableColumnDateFormat()
ColumnTest::testDataTableColumnDateFormat |
( |
| ) |
|
Definition at line 99 of file ColumnTest.php.
References $format, and ILIAS\Repository\lng().
101 $df = new \ILIAS\Data\Factory();
102 $format = $df->dateFormat()->germanShort();
103 $dat = new \DateTimeImmutable();
104 $col =
new Column\Date($this->
lng,
'col',
$format);
105 $this->assertEquals($dat->format(
$format->toString()), $col->format($dat));
◆ testDataTableColumnLinkListingFormat()
ColumnTest::testDataTableColumnLinkListingFormat |
( |
| ) |
|
◆ testDataTableColumnLinkListingFormatAcceptsOnlyLinkListings()
ColumnTest::testDataTableColumnLinkListingFormatAcceptsOnlyLinkListings |
( |
| ) |
|
Definition at line 207 of file ColumnTest.php.
References ILIAS\Repository\lng().
209 $this->expectException(\InvalidArgumentException::class);
210 $col =
new Column\LinkListing($this->
lng,
'col');
212 $this->assertEquals($linklisting_invalid, $col->format($linklisting_invalid));
◆ testDataTableColumnLinkListingItemsFormatAcceptsOnlyLinks()
ColumnTest::testDataTableColumnLinkListingItemsFormatAcceptsOnlyLinks |
( |
| ) |
|
Definition at line 215 of file ColumnTest.php.
References ILIAS\Repository\lng().
217 $this->expectException(\InvalidArgumentException::class);
218 $col =
new Column\LinkListing($this->
lng,
'col');
219 $link =
'some string';
221 $this->assertEquals($linklisting_invalid, $col->format($linklisting_invalid));
◆ testDataTableColumnNumnberFormat()
ColumnTest::testDataTableColumnNumnberFormat |
( |
| ) |
|
Definition at line 120 of file ColumnTest.php.
References ILIAS\Repository\lng().
122 $df = new \ILIAS\Data\Factory();
123 $dat = new \DateTimeImmutable();
124 $col =
new Column\Number($this->
lng,
'col');
125 $this->assertEquals(
'1', $col->format(1));
126 $col = $col->withDecimals(3);
127 $this->assertEquals(
'1,000', $col->format(1));
128 $col = $col->withDecimals(2)->withUnit(
'$', $col::UNIT_POSITION_FORE);
129 $this->assertEquals(
'$ 1,00', $col->format(1));
130 $col = $col->withUnit(
'€', $col::UNIT_POSITION_AFT);
131 $this->assertEquals(
'1,00 €', $col->format(1));
◆ testDataTableColumnsAttributes()
ColumnTest::testDataTableColumnsAttributes |
( |
| ) |
|
Definition at line 46 of file ColumnTest.php.
References ILIAS\Repository\lng().
48 $col =
new Column\Text($this->
lng,
'col');
49 $this->assertEquals(
'col', $col->getTitle());
51 $this->assertTrue($col->isSortable());
52 $this->assertFalse($col->withIsSortable(
false)->isSortable());
53 $this->assertTrue($col->withIsSortable(
true)->isSortable());
55 'col, order_option_alphabetical_ascending',
56 'col, order_option_alphabetical_descending',
57 ], $col->getOrderingLabels());
59 $this->assertFalse($col->isOptional());
60 $this->assertTrue($col->withIsOptional(
true)->isOptional());
61 $this->assertFalse($col->withIsOptional(
false)->isOptional());
63 $this->assertTrue($col->isInitiallyVisible());
64 $this->assertFalse($col->withIsOptional(
true,
false)->isInitiallyVisible());
65 $this->assertTrue($col->withIsOptional(
true,
true)->isInitiallyVisible());
67 $this->assertFalse($col->isHighlighted());
68 $this->assertTrue($col->withHighlight(
true)->isHighlighted());
69 $this->assertFalse($col->withHighlight(
false)->isHighlighted());
71 $this->assertEquals(12, $col->withIndex(12)->getIndex());
◆ testDataTableColumnTimespanFormat()
ColumnTest::testDataTableColumnTimespanFormat |
( |
| ) |
|
Definition at line 108 of file ColumnTest.php.
References $format, and ILIAS\Repository\lng().
110 $df = new \ILIAS\Data\Factory();
111 $format = $df->dateFormat()->germanShort();
112 $dat = new \DateTimeImmutable();
113 $col =
new Column\Timespan($this->
lng,
'col',
$format);
115 $dat->format(
$format->toString()) .
' - ' . $dat->format(
$format->toString()),
116 $col->format([$dat, $dat])
The documentation for this class was generated from the following file: