19declare(strict_types=1);
22require_once(
"libs/composer/vendor/autoload.php");
23require_once(__DIR__ .
"/../../../Base.php");
39 $lng = $this->getMockBuilder(\ilLanguage::class)
40 ->disableOriginalConstructor()
42 $lng->method(
'txt')->willReturnCallback(fn($v) => $v);
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());
77 $this->assertEquals(
'TRUE', $col->format(
true));
78 $this->assertEquals(
'FALSE', $col->format(
false));
83 $ok =
new StandardIcon(
'',
'ok',
'small',
false);
84 $no =
new StandardIcon(
'',
'notok',
'small',
false);
86 $this->assertEquals($ok, $col->format(
true));
87 $this->assertEquals($no, $col->format(
false));
92 $ok =
new Glyph(GlyphInterface::LIKE,
'');
93 $no =
new Glyph(GlyphInterface::DISLIKE,
'');
95 $this->assertEquals($ok, $col->format(
true));
96 $this->assertEquals($no, $col->format(
false));
101 $df = new \ILIAS\Data\Factory();
102 $format = $df->dateFormat()->germanShort();
103 $dat = new \DateTimeImmutable();
105 $this->assertEquals($dat->format(
$format->toString()), $col->format($dat));
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])
122 $df = new \ILIAS\Data\Factory();
123 $dat = new \DateTimeImmutable();
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));
169 'value' =>
'some string',
174 'value' =>
new StandardIcon(
'',
'',
'small',
false),
179 'value' =>
'some string',
194 $this->expectException(\InvalidArgumentException::class);
196 $this->assertEquals($value, $column->format($value));
204 $this->assertEquals($linklisting, $col->format($linklisting));
209 $this->expectException(\InvalidArgumentException::class);
212 $this->assertEquals($linklisting_invalid, $col->format($linklisting_invalid));
217 $this->expectException(\InvalidArgumentException::class);
219 $link =
'some string';
221 $this->assertEquals($linklisting_invalid, $col->format($linklisting_invalid));
227 ->withIsSortable(
true)
228 ->withOrderingLabels(
237 $col->getOrderingLabels()
Basic Tests for Table-Columns.
testDataTableColumnBoolFormat()
testDataTableColumnLinkListingItemsFormatAcceptsOnlyLinks()
testDataTableColumnNumnberFormat()
testDataTableColumnAllowedFormats(Column\Column $column, $value, bool $ok)
 * @dataProvider provideColumnFormats 
static provideColumnFormats()
testDataTableColumnLinkListingFormat()
testDataTableColumnLinkListingFormatAcceptsOnlyLinkListings()
testDataTableColumnDateFormat()
testDataTableColumnBoolFormatWithIcon()
testDataTableColumnBoolFormatWithGlyph()
testDataTableColumnsAttributes()
testDataTableColumnTimespanFormat()
testDataTableColumnCustomOrderingLabels()
This implements commonalities between Links.
Provides common functionality for UI tests.
if(!file_exists(getcwd() . '/ilias.ini.php'))
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This describes how a glyph could be modified during construction of UI.
A Column describes the form of presentation for a certain aspect of data, i.e.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...