ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
BaseNotificationSetUp.php
Go to the documentation of this file.
1 <?php
2 
28 use ILIAS\UI\Component as C;
29 
33 
34 require_once('./libs/composer/vendor/autoload.php');
35 require_once(__DIR__ . "/../../UI/Base.php");
36 
42 abstract class BaseNotificationSetUp extends TestCase
43 {
45 
49  protected $id;
53  protected $provider;
57  protected $identification;
61  protected $factory;
62 
63 
67  protected function setUp(): void
68  {
69  parent::setUp();
70 
71  $this->identification = new IdentificationFactory(new NullProviderFactory());
72  $this->provider = \Mockery::mock(NotificationProvider::class);
73  $this->provider->shouldReceive('getProviderNameForPresentation')->andReturn('Provider');
74 
75  $this->id = $this->identification->core($this->provider)->identifier('dummy');
76 
77  $this->factory = new NotificationFactory();
78  }
79 
80  public function getUIFactory(): NoUIFactory
81  {
82  $factory = new class () extends NoUIFactory {
83  public function item(): ILIAS\UI\Component\Item\Factory
84  {
85  return new I\Item\Factory();
86  }
87  public function symbol(): ILIAS\UI\Component\Symbol\Factory
88  {
89  return new I\Symbol\Factory(
90  new I\Symbol\Icon\Factory(),
91  new I\Symbol\Glyph\Factory(),
92  new I\Symbol\Avatar\Factory()
93  );
94  }
95  public function mainControls(): C\MainControls\Factory
96  {
97  return new I\MainControls\Factory(
98  $this->sig_gen,
99  new I\MainControls\Slate\Factory(
100  $this->sig_gen,
101  new Factory(),
102  new I\Symbol\Factory(
103  new I\Symbol\Icon\Factory(),
104  new I\Symbol\Glyph\Factory(),
105  new I\Symbol\Avatar\Factory()
106  )
107  )
108  );
109  }
110  };
111 
112  $factory->sig_gen = Mockery::mock(I\SignalGeneratorInterface::class);
113  $factory->sig_gen->shouldReceive("create")->andReturn(new I\Signal("id"));
114  return $factory;
115  }
116 
117  public function getDIC(): ILIAS\DI\Container
118  {
119  $mocks = [
120  'ui' => $this->createMock(\ILIAS\DI\UIServices::class),
121  'ui.factory' => $this->createMock(\ILIAS\UI\Factory::class),
122  'provider_factory'=> $this->createMock(ProviderFactory::class),
123  ];
124  return new class ($mocks) extends ILIAS\DI\Container {
125  public function globalScreen(): Services
126  {
127  return new Services($this['provider_factory'], $this['ui']);
128  }
129  };
130  }
131 
133  {
134  $dic = $this->getDIC();
135  $provider = new class ($dic) extends AbstractNotificationProvider {
136  public function getNotifications(): array
137  {
138  return $this->notifications;
139  }
140  };
141  $provider->notifications = $notifications;
142  return $provider;
143  }
144 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class Factory.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class BaseNotificationSetUp.
Class ChatMainBarProvider .
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class HTTPServicesTest.
getDummyNotificationsProviderWithNotifications($notifications)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class IdentificationFactory All elements in the GlobalScreen service must be identifiable for the sup...
This is how a factory for Items looks like.
Definition: Factory.php:28
$dic
Definition: result.php:32