ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ColumnFactoryTest.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
21 require_once 'tests/UI/AbstractFactoryTest.php';
22 
24 use ILIAS\Data;
25 
27 {
29  "text" => ["context" => false, "rules" => false],
30  "number" => ["context" => false, "rules" => false],
31  "date" => ["context" => false, "rules" => false],
32  "boolean" => ["context" => false, "rules" => false],
33  "eMail" => ["context" => false, "rules" => false],
34  "status" => ["context" => false, "rules" => false],
35  "statusIcon" => ["context" => false, "rules" => false],
36  "timeSpan" => ["context" => false, "rules" => false],
37  "link" => ["context" => false, "rules" => false],
38  "linkListing" => ["context" => false, "rules" => false]
39  ];
40 
41  public $factory_title = 'ILIAS\\UI\\Component\\Table\\Column\\Factory';
42 
43  protected function buildFactories()
44  {
45  $lng = $this->getMockBuilder(\ilLanguage::class)
46  ->disableOriginalConstructor()
47  ->getMock();
48  $lng->method('txt')->willReturnCallback(fn($v) => $v);
49 
50  return [
51  new \ILIAS\UI\Implementation\Component\Table\Column\Factory($lng),
52  new Data\Factory()
53  ];
54  }
55 
56  public function getColumnTypeProvider(): array
57  {
58  list($f, $df) = $this->buildFactories();
59  $date_format = $df->dateFormat()->germanShort();
60 
61  return [
62  [Column\Text::class, $f->text("")],
63  [Column\Date::class, $f->date("", $date_format)],
64  [Column\TimeSpan::class, $f->timespan("", $date_format)],
65  [Column\Number::class, $f->number("")],
66  [Column\Boolean::class, $f->boolean("", '1', '0')],
67  [Column\Status::class, $f->status("")],
68  [Column\StatusIcon::class, $f->statusIcon("")],
69  [Column\EMail::class, $f->eMail("")],
70  [Column\Link::class, $f->link("")],
71  [Column\LinkListing::class, $f->linkListing("")]
72  ];
73  }
74 
78  public function testDataTableColsImplementInterfaces($class, $instance)
79  {
80  $this->assertInstanceOf(Column\Column::class, $instance);
81  $this->assertInstanceOf($class, $instance);
82  }
83 }
$lng
Defines tests every SHOULD pass UI-factory.
testDataTableColsImplementInterfaces($class, $instance)
getColumnTypeProvider
A Column describes the form of presentation for a certain aspect of data, i.e.
Definition: Column.php:27