ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
TableTestBase.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
21 require_once("vendor/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(\ILIAS\UI\Implementation\Component\Input\Field\Node\Factory::class),
40  $this->createMock(UploadLimitResolver::class),
41  new C\SignalGenerator(),
42  new \ILIAS\Data\Factory(),
43  $this->buildRefinery(),
44  $this->getLanguage()
45  );
46  }
47 
48  protected function buildRefinery(): Refinery
49  {
50  return new Refinery(
51  new \ILIAS\Data\Factory(),
52  $this->createMock(ILIAS\Language\Language::class)
53  );
54  }
55 
57  {
58  return new ViewControl\Factory(
59  $this->buildFieldFactory(),
60  new \ILIAS\Data\Factory(),
61  $this->buildRefinery(),
62  new C\SignalGenerator(),
63  $this->getLanguage(),
64  );
65  }
66 
68  {
69  return new ViewControlContainer\Factory(
70  new C\SignalGenerator(),
71  $this->getViewControlFactory(),
72  );
73  }
74 
75  protected function getTableFactory(): C\Table\Factory
76  {
77  return new C\Table\Factory(
78  new C\SignalGenerator(),
79  $this->getViewControlFactory(),
81  new \ILIAS\Data\Factory(),
82  new C\Table\Column\Factory($this->getLanguage()),
83  new C\Table\Action\Factory(),
84  $this->getMockStorage(),
85  new C\Table\DataRowBuilder(),
86  new C\Table\OrderingRowBuilder()
87  );
88  }
89 
90  protected function getMockStorage(): ArrayAccess
91  {
92  return new class () implements ArrayAccess {
93  protected array $data = [];
94  public function offsetExists(mixed $offset): bool
95  {
96  return isset($this->data[$offset]);
97  }
98  public function offsetGet(mixed $offset): mixed
99  {
100  if(!$this->offsetExists($offset)) {
101  return null;
102  }
103  return $this->data[$offset];
104  }
105  public function offsetSet(mixed $offset, mixed $value): void
106  {
107  $this->data[$offset] = $value;
108  }
109  public function offsetUnset(mixed $offset): void
110  {
111  unset($this->data[$offset]);
112  }
113  };
114  }
115 }
This implements commonalities between inputs.
Definition: Input.php:42
Interface Observer Contains several chained tasks and infos about them.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
getLanguage()
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