ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
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(UploadLimitResolver::class),
63  new SignalGenerator(),
64  $this->buildDataFactory(),
65  $this->buildRefinery(),
66  $this->getLanguage()
67  );
68  }
69 
70  protected function buildVCFactory(): Control\Factory
71  {
72  return new Control\Factory(
73  $this->buildFieldFactory(),
74  $this->buildDataFactory(),
75  $this->buildRefinery(),
76  new SignalGenerator(),
77  $this->getLanguage(),
78  );
79  }
80 
81  public function getUIFactory(): NoUIFactory
82  {
83  $factory = new class () extends NoUIFactory {
84  protected SignalGenerator $sig_gen;
85  public function __construct()
86  {
87  $this->sig_gen = new SignalGenerator();
88  }
89  public function button(): I\Button\Factory
90  {
91  return new I\Button\Factory(
92  new SignalGenerator()
93  );
94  }
95  public function symbol(): ILIAS\UI\Component\Symbol\Factory
96  {
97  return new I\Symbol\Factory(
98  new I\Symbol\Icon\Factory(),
99  new I\Symbol\Glyph\Factory(),
100  new I\Symbol\Avatar\Factory()
101  );
102  }
103  };
104  return $factory;
105  }
106 
107  public function getDataFactory(): Data\Factory
108  {
109  return $this->buildDataFactory();
110  }
111 }
button(string $caption, string $cmd)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...