ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
BaseNotificationSetUp.php
Go to the documentation of this file.
1<?php
8use Mockery\Adapter\Phpunit\MockeryPHPUnitIntegration;
11use \ILIAS\UI\Component as C;
12
13use PHPUnit\Framework\TestCase;
14use \ILIAS\UI\Implementation\Component as I;
15
16require_once('./libs/composer/vendor/autoload.php');
17require_once(__DIR__ . "/../../UI/Base.php");
18
24abstract class BaseNotificationSetUp extends TestCase
25{
26 use MockeryPHPUnitIntegration;
27
31 protected $id;
35 protected $provider;
39 protected $identification;
43 protected $factory;
44
45
49 protected function setUp() : void
50 {
51 parent::setUp();
52
53 $this->identification = new IdentificationFactory(new NullProviderFactory());
54 $this->provider = \Mockery::mock(NotificationProvider::class);
55 $this->provider->shouldReceive('getProviderNameForPresentation')->andReturn('Provider');
56
57 $this->id = $this->identification->core($this->provider)->identifier('dummy');
58
59 $this->factory = new NotificationFactory();
60 }
61
62 public function getUIFactory()
63 {
64 $factory = new class extends NoUIFactory {
65 public function item()
66 {
67 return new I\Item\Factory();
68 }
69 public function symbol() : ILIAS\UI\Component\Symbol\Factory
70 {
71 return new I\Symbol\Factory(
72 new I\Symbol\Icon\Factory(),
73 new I\Symbol\Glyph\Factory(),
74 new I\Symbol\Avatar\Factory()
75 );
76 }
77 public function mainControls() : C\MainControls\Factory
78 {
79 return new I\MainControls\Factory(
80 $this->sig_gen,
81 new I\MainControls\Slate\Factory(
82 $this->sig_gen,
83 new \ILIAS\UI\Implementation\Component\Counter\Factory(),
84 new I\Symbol\Factory(
85 new I\Symbol\Icon\Factory(),
86 new I\Symbol\Glyph\Factory(),
87 new I\Symbol\Avatar\Factory()
88 )
89 )
90 );
91 }
92 };
93
94 $factory->sig_gen = Mockery::mock(I\SignalGeneratorInterface::class);
95 $factory->sig_gen->shouldReceive("create")->andReturn(new I\Signal("id"));
96 return $factory;
97 }
98
99 public function getDIC()
100 {
101 $dic = new class extends ILIAS\DI\Container {
102 public function globalScreen()
103 {
104 return new Services(Mockery::mock(ProviderFactory::class));
105 }
106 };
107 return $dic;
108 }
109
111 {
112 $dic = $this->getDIC();
113 $provider = new class($dic) extends AbstractNotificationProvider {
114 public function getNotifications() : array
115 {
116 return $this->notifications;
117 }
118 };
119 $provider->notifications = $notifications;
120 return $provider;
121 }
122}
Class BaseNotificationSetUp.
getDummyNotificationsProviderWithNotifications($notifications)
An exception for terminatinating execution or to throw for unit testing.
Class HTTPServicesTest.
Class ChatMainBarProvider \MainMenu\Provider.
Class ilAsqQuestionAuthoringFactory.
Class Factory.
$dic
Definition: result.php:13