19declare(strict_types=1);
22require_once(
"vendor/composer/vendor/autoload.php");
23require_once(__DIR__ .
"/../../../Base.php");
43 ->disableOriginalConstructor()
45 $lng->method(
'txt')->willReturnCallback(fn($v) => $v);
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());
80 $this->assertEquals(
'TRUE', $col->format(
true));
81 $this->assertEquals(
'FALSE', $col->format(
false));
86 $ok =
new StandardIcon(
'',
'ok',
'small',
false);
87 $no =
new StandardIcon(
'',
'notok',
'small',
false);
89 $this->assertEquals($ok, $col->format(
true));
90 $this->assertEquals($no, $col->format(
false));
95 $ok =
new Glyph(GlyphInterface::LIKE,
'');
96 $no =
new Glyph(GlyphInterface::DISLIKE,
'');
98 $this->assertEquals($ok, $col->format(
true));
99 $this->assertEquals($no, $col->format(
false));
104 $df = new \ILIAS\Data\Factory();
105 $format = $df->dateFormat()->germanShort();
106 $dat = new \DateTimeImmutable();
108 $this->assertEquals($dat->format($format->toString()), $col->format($dat));
113 $df = new \ILIAS\Data\Factory();
114 $format = $df->dateFormat()->germanShort();
115 $dat = new \DateTimeImmutable();
118 $dat->format($format->toString()) .
' - ' . $dat->format($format->toString()),
119 $col->format([$dat, $dat])
125 $df = new \ILIAS\Data\Factory();
126 $dat = new \DateTimeImmutable();
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));
152 'value' =>
new Listing\Unordered([
'string',
'string']),
167 'value' =>
new Link\Standard(
'label',
'#'),
172 'value' =>
'some string',
177 'value' =>
new StandardIcon(
'',
'',
'small',
false),
182 'value' =>
'some string',
188 #[\PHPUnit\Framework\Attributes\DataProvider('provideColumnFormats')]
195 $this->expectException(\InvalidArgumentException::class);
197 $this->assertEquals($value, $column->format($value));
204 $link =
new Link\Standard(
'label',
'#');
205 $linklisting =
new Listing\Unordered([$link, $link, $link]);
206 $this->assertEquals($linklisting, $col->format($linklisting));
211 $this->expectException(\InvalidArgumentException::class);
213 $linklisting_invalid =
new Link\Standard(
'label',
'#');
214 $this->assertEquals($linklisting_invalid, $col->format($linklisting_invalid));
219 $this->expectException(\InvalidArgumentException::class);
221 $link =
'some string';
222 $linklisting_invalid =
new Listing\Unordered([$link, $link, $link]);
223 $this->assertEquals($linklisting_invalid, $col->format($linklisting_invalid));
229 ->withIsSortable(
true)
230 ->withOrderingLabels(
239 $col->getOrderingLabels()
Basic Tests for Table-Columns.
testDataTableColumnBoolFormat()
testDataTableColumnLinkListingItemsFormatAcceptsOnlyLinks()
testDataTableColumnNumnberFormat()
static provideColumnFormats()
testDataTableColumnLinkListingFormat()
testDataTableColumnLinkListingFormatAcceptsOnlyLinkListings()
testDataTableColumnDateFormat()
testDataTableColumnAllowedFormats(Column\Column $column, mixed $value, bool $ok)
testDataTableColumnBoolFormatWithIcon()
testDataTableColumnBoolFormatWithGlyph()
testDataTableColumnsAttributes()
testDataTableColumnTimespanFormat()
testDataTableColumnCustomOrderingLabels()
This implements commonalities between Links.
Provides common functionality for UI tests.
A Column describes the form of presentation for a certain aspect of data, i.e.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.
if(!file_exists('../ilias.ini.php'))