ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
TableTestBase.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
21 require_once("libs/composer/vendor/autoload.php");
22 require_once(__DIR__ . "/../../Base.php");
23 
30 
34 abstract class TableTestBase extends ILIAS_UI_TestBase
35 {
36  protected function buildFieldFactory(): FieldFactory
37  {
38  return new FieldFactory(
39  $this->createMock(UploadLimitResolver::class),
40  new C\SignalGenerator(),
41  new \ILIAS\Data\Factory(),
42  $this->buildRefinery(),
43  $this->getLanguage()
44  );
45  }
46 
47  protected function buildRefinery(): Refinery
48  {
49  return new Refinery(
50  new \ILIAS\Data\Factory(),
51  $this->createMock(ilLanguage::class)
52  );
53  }
54 
56  {
57  return new ViewControl\Factory(
58  $this->buildFieldFactory(),
59  new \ILIAS\Data\Factory(),
60  $this->buildRefinery(),
61  new C\SignalGenerator(),
62  $this->getLanguage(),
63  );
64  }
65 
67  {
69  new C\SignalGenerator(),
70  $this->getViewControlFactory(),
71  );
72  }
73 
74  protected function getTableFactory(): C\Table\Factory
75  {
76  return new C\Table\Factory(
77  new C\SignalGenerator(),
78  $this->getViewControlFactory(),
80  new \ILIAS\Data\Factory(),
81  new C\Table\Column\Factory($this->getLanguage()),
82  new C\Table\Action\Factory(),
83  new C\Table\DataRowBuilder(),
84  $this->getMockStorage(),
85  new C\Table\OrderingRowBuilder(),
86  );
87  }
88 
89  protected function getMockStorage(): ArrayAccess
90  {
91  return new class () implements ArrayAccess {
92  protected array $data = [];
93  public function offsetExists(mixed $offset): bool
94  {
95  return isset($this->data[$offset]);
96  }
97  public function offsetGet(mixed $offset): mixed
98  {
99  if (!$this->offsetExists($offset)) {
100  return null;
101  }
102  return $this->data[$offset];
103  }
104  public function offsetSet(mixed $offset, mixed $value): void
105  {
106  $this->data[$offset] = $value;
107  }
108  public function offsetUnset(mixed $offset): void
109  {
110  unset($this->data[$offset]);
111  }
112  };
113  }
114 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ChatMainBarProvider .
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Provides common functionality for UI tests.
Definition: Base.php:310
Builds data types.
Definition: Factory.php:35
Basic Tests for all Tables.
getViewControlContainerFactory()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Factory.php:21