ILIAS  release_8 Revision v8.23
BaseToastSetUp.php
Go to the documentation of this file.
1 <?php
18 declare(strict_types=1);
19 
28 
29 require_once('./libs/composer/vendor/autoload.php');
30 require_once(__DIR__ . "/../../UI/Base.php");
31 
32 abstract class BaseToastSetUp extends TestCase
33 {
34  private array $toasts = [];
35 
36  private \ILIAS\DI\UIServices $ui_mock;
39 
43  protected function setUp(): void
44  {
45  parent::setUp();
46 
47  $this->ui_mock = $this->createMock(\ILIAS\DI\UIServices::class);
48  $this->provider = $this->createMock(ToastProvider::class);
49  $this->provider->expects($this->any())->method('getProviderNameForPresentation')->willReturn('Provider');
50  $this->factory = (new ToastServices($this->ui_mock))->factory();
51  }
52 
53  public function getDIC(): ILIAS\DI\Container
54  {
55  $mocks = [
56  'ui' => $this->createMock(\ILIAS\DI\UIServices::class),
57  'ui.factory' => $this->createMock(\ILIAS\UI\Factory::class),
58  'provider_factory'=> $this->createMock(ProviderFactory::class),
59  ];
60  return new class ($mocks) extends ILIAS\DI\Container {
61  public function globalScreen(): Services
62  {
63  return new Services($this['provider_factory'], $this['ui']);
64  }
65  };
66  }
67 
69  {
70  $dic = $this->getDIC();
71  $provider = new class ($dic) extends AbstractToastProvider {
72  public array $toasts;
73  public function getToasts(): array
74  {
75  return $this->toasts;
76  }
77  };
78  $provider->toasts = $toasts;
79  return $provider;
80  }
81 }
Class Factory.
Class ChatMainBarProvider .
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:31
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ToastFactory $factory
Class HTTPServicesTest.
ToastProvider $provider
ILIAS DI UIServices $ui_mock
getDummyToastProviderWithToasts(array $toasts)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$dic
Definition: result.php:32