ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
TableTestBase.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21require_once("vendor/composer/vendor/autoload.php");
22require_once(__DIR__ . "/../../Base.php");
23
28use ILIAS\Refinery\Factory as Refinery;
30
34abstract 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
56 protected function getViewControlFactory(): ViewControl\Factory
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
67 protected function getViewControlContainerFactory(): ViewControlContainer\Factory
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}
Factory for Date Formats.
Definition: Factory.php:27
Builds data types.
Definition: Factory.php:36
This implements commonalities between inputs.
Definition: Input.php:43
Definition: UI.php:24
Provides common functionality for UI tests.
Definition: Base.php:337
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
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.
getLanguage()