Basic Tests for Table-Columns.
More...
Basic Tests for Table-Columns.
Definition at line 36 of file ColumnTest.php.
◆ provideColumnFormats()
static ColumnTest::provideColumnFormats |
( |
| ) |
|
|
static |
Definition at line 137 of file ColumnTest.php.
References ILIAS\GlobalScreen\Provider\__construct().
146 'column' =>
new Column\LinkListing(
$lng,
''),
151 'column' =>
new Column\LinkListing(
$lng,
''),
152 'value' =>
new Listing\Unordered([
'string',
'string']),
156 'column' =>
new Column\LinkListing(
$lng,
''),
161 'column' =>
new Column\LinkListing(
$lng,
''),
166 'column' =>
new Column\Link(
$lng,
''),
167 'value' =>
new Link\Standard(
'label',
'#'),
171 'column' =>
new Column\Link(
$lng,
''),
172 'value' =>
'some string',
176 'column' =>
new Column\StatusIcon(
$lng,
''),
181 'column' =>
new Column\StatusIcon(
$lng,
''),
182 'value' =>
'some string',
__construct(Container $dic, ilPlugin $plugin)
◆ setUp()
Definition at line 40 of file ColumnTest.php.
References $lng, and ILIAS\Repository\lng().
43 ->disableOriginalConstructor()
45 $lng->method(
'txt')->willReturnCallback(fn($v) => $v);
Interface Observer Contains several chained tasks and infos about them.
◆ testDataTableColumnAllowedFormats()
ColumnTest::testDataTableColumnAllowedFormats |
( |
Column\Column |
$column, |
|
|
mixed |
$value, |
|
|
bool |
$ok |
|
) |
| |
 * provideColumnFormats 
Definition at line 191 of file ColumnTest.php.
197 $this->expectException(\InvalidArgumentException::class);
199 $this->assertEquals($value, $column->format($value));
◆ testDataTableColumnBoolFormat()
ColumnTest::testDataTableColumnBoolFormat |
( |
| ) |
|
Definition at line 77 of file ColumnTest.php.
References ILIAS\Repository\lng().
79 $col =
new Column\Boolean($this->
lng,
'col',
'TRUE',
'FALSE');
80 $this->assertEquals(
'TRUE', $col->format(
true));
81 $this->assertEquals(
'FALSE', $col->format(
false));
◆ testDataTableColumnBoolFormatWithGlyph()
ColumnTest::testDataTableColumnBoolFormatWithGlyph |
( |
| ) |
|
Definition at line 93 of file ColumnTest.php.
References ILIAS\Repository\lng().
95 $ok =
new Glyph(GlyphInterface::LIKE,
'');
96 $no =
new Glyph(GlyphInterface::DISLIKE,
'');
97 $col =
new Column\Boolean($this->
lng,
'col', $ok, $no);
98 $this->assertEquals($ok, $col->format(
true));
99 $this->assertEquals($no, $col->format(
false));
◆ testDataTableColumnBoolFormatWithIcon()
ColumnTest::testDataTableColumnBoolFormatWithIcon |
( |
| ) |
|
Definition at line 84 of file ColumnTest.php.
References ILIAS\Repository\lng().
88 $col =
new Column\Boolean($this->
lng,
'col', $ok, $no);
89 $this->assertEquals($ok, $col->format(
true));
90 $this->assertEquals($no, $col->format(
false));
◆ testDataTableColumnCustomOrderingLabels()
ColumnTest::testDataTableColumnCustomOrderingLabels |
( |
| ) |
|
Definition at line 228 of file ColumnTest.php.
References ILIAS\Repository\lng().
230 $col = (
new Column\LinkListing($this->
lng,
'col'))
231 ->withIsSortable(
true)
232 ->withOrderingLabels(
241 $col->getOrderingLabels()
◆ testDataTableColumnDateFormat()
ColumnTest::testDataTableColumnDateFormat |
( |
| ) |
|
Definition at line 102 of file ColumnTest.php.
References ILIAS\Repository\lng().
104 $df = new \ILIAS\Data\Factory();
105 $format = $df->dateFormat()->germanShort();
106 $dat = new \DateTimeImmutable();
107 $col =
new Column\Date($this->
lng,
'col', $format);
108 $this->assertEquals($dat->format($format->toString()), $col->format($dat));
◆ testDataTableColumnLinkListingFormat()
ColumnTest::testDataTableColumnLinkListingFormat |
( |
| ) |
|
Definition at line 203 of file ColumnTest.php.
References ILIAS\Repository\lng().
205 $col =
new Column\LinkListing($this->
lng,
'col');
206 $link =
new Link\Standard(
'label',
'#');
207 $linklisting =
new Listing\Unordered([$link, $link, $link]);
208 $this->assertEquals($linklisting, $col->format($linklisting));
◆ testDataTableColumnLinkListingFormatAcceptsOnlyLinkListings()
ColumnTest::testDataTableColumnLinkListingFormatAcceptsOnlyLinkListings |
( |
| ) |
|
Definition at line 211 of file ColumnTest.php.
References ILIAS\Repository\lng().
213 $this->expectException(\InvalidArgumentException::class);
214 $col =
new Column\LinkListing($this->
lng,
'col');
215 $linklisting_invalid =
new Link\Standard(
'label',
'#');
216 $this->assertEquals($linklisting_invalid, $col->format($linklisting_invalid));
◆ testDataTableColumnLinkListingItemsFormatAcceptsOnlyLinks()
ColumnTest::testDataTableColumnLinkListingItemsFormatAcceptsOnlyLinks |
( |
| ) |
|
Definition at line 219 of file ColumnTest.php.
References ILIAS\Repository\lng().
221 $this->expectException(\InvalidArgumentException::class);
222 $col =
new Column\LinkListing($this->
lng,
'col');
223 $link =
'some string';
224 $linklisting_invalid =
new Listing\Unordered([$link, $link, $link]);
225 $this->assertEquals($linklisting_invalid, $col->format($linklisting_invalid));
◆ testDataTableColumnNumnberFormat()
ColumnTest::testDataTableColumnNumnberFormat |
( |
| ) |
|
Definition at line 123 of file ColumnTest.php.
References ILIAS\Repository\lng().
125 $df = new \ILIAS\Data\Factory();
126 $dat = new \DateTimeImmutable();
127 $col =
new Column\Number($this->
lng,
'col');
128 $this->assertEquals(
'1', $col->format(1));
129 $col = $col->withDecimals(3);
130 $this->assertEquals(
'1,000', $col->format(1));
131 $col = $col->withDecimals(2)->withUnit(
'$', $col::UNIT_POSITION_FORE);
132 $this->assertEquals(
'$ 1,00', $col->format(1));
133 $col = $col->withUnit(
'€', $col::UNIT_POSITION_AFT);
134 $this->assertEquals(
'1,00 €', $col->format(1));
◆ testDataTableColumnsAttributes()
ColumnTest::testDataTableColumnsAttributes |
( |
| ) |
|
Definition at line 49 of file ColumnTest.php.
References ILIAS\Repository\lng().
51 $col =
new Column\Text($this->
lng,
'col');
52 $this->assertEquals(
'col', $col->getTitle());
54 $this->assertTrue($col->isSortable());
55 $this->assertFalse($col->withIsSortable(
false)->isSortable());
56 $this->assertTrue($col->withIsSortable(
true)->isSortable());
58 'col, order_option_alphabetical_ascending',
59 'col, order_option_alphabetical_descending',
60 ], $col->getOrderingLabels());
62 $this->assertFalse($col->isOptional());
63 $this->assertTrue($col->withIsOptional(
true)->isOptional());
64 $this->assertFalse($col->withIsOptional(
false)->isOptional());
66 $this->assertTrue($col->isInitiallyVisible());
67 $this->assertFalse($col->withIsOptional(
true,
false)->isInitiallyVisible());
68 $this->assertTrue($col->withIsOptional(
true,
true)->isInitiallyVisible());
70 $this->assertFalse($col->isHighlighted());
71 $this->assertTrue($col->withHighlight(
true)->isHighlighted());
72 $this->assertFalse($col->withHighlight(
false)->isHighlighted());
74 $this->assertEquals(12, $col->withIndex(12)->getIndex());
◆ testDataTableColumnTimespanFormat()
ColumnTest::testDataTableColumnTimespanFormat |
( |
| ) |
|
Definition at line 111 of file ColumnTest.php.
References ILIAS\Repository\lng().
113 $df = new \ILIAS\Data\Factory();
114 $format = $df->dateFormat()->germanShort();
115 $dat = new \DateTimeImmutable();
116 $col =
new Column\TimeSpan($this->
lng,
'col', $format);
118 $dat->format($format->toString()) .
' - ' . $dat->format($format->toString()),
119 $col->format([$dat, $dat])
◆ $lng
The documentation for this class was generated from the following file: