ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
ViewControlTestBase.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
26 use ILIAS\Data;
29 
30 abstract class ViewControlTestBase extends ILIAS_UI_TestBase
31 {
32  protected function getNamesource()
33  {
34  return new class () implements NameSource {
35  public int $count = 0;
36  public function getNewName(): string
37  {
38  $name = "name_{$this->count}";
39  $this->count++;
40 
41  return $name;
42  }
43  };
44  }
45 
46  protected function buildDataFactory(): Data\Factory
47  {
48  return new Data\Factory();
49  }
50 
51  protected function buildRefinery(): Refinery
52  {
53  return new Refinery(
54  $this->buildDataFactory(),
55  $this->createMock(ILIAS\Language\Language::class)
56  );
57  }
58 
59  protected function buildFieldFactory(): FieldFactory
60  {
61  return new FieldFactory(
62  $this->createMock(\ILIAS\UI\Implementation\Component\Input\Field\Node\Factory::class),
63  $this->createMock(UploadLimitResolver::class),
64  new SignalGenerator(),
65  $this->buildDataFactory(),
66  $this->buildRefinery(),
67  $this->getLanguage()
68  );
69  }
70 
71  protected function buildVCFactory(): Control\Factory
72  {
73  return new Control\Factory(
74  $this->buildFieldFactory(),
75  $this->buildDataFactory(),
76  $this->buildRefinery(),
77  new SignalGenerator(),
78  $this->getLanguage(),
79  );
80  }
81 
82  public function getUIFactory(): NoUIFactory
83  {
84  $factory = new class () extends NoUIFactory {
85  protected SignalGenerator $sig_gen;
86  public function __construct()
87  {
88  $this->sig_gen = new SignalGenerator();
89  }
90  public function button(): I\Button\Factory
91  {
92  return new I\Button\Factory();
93  }
94  public function symbol(): I\Symbol\Factory
95  {
96  return new I\Symbol\Factory(
97  new I\Symbol\Icon\Factory(),
98  new I\Symbol\Glyph\Factory(),
99  new I\Symbol\Avatar\Factory()
100  );
101  }
102  };
103  return $factory;
104  }
105 
106  public function getDataFactory(): Data\Factory
107  {
108  return $this->buildDataFactory();
109  }
110 }
button(string $caption, string $cmd)
Interface Observer Contains several chained tasks and infos about them.
getLanguage()
Builds data types.
Definition: Factory.php:35
__construct(Container $dic, ilPlugin $plugin)
Describes a source for input names.
Definition: NameSource.php:26
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Factory.php:21