ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
InitHttpServicesTest.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
29use PHPUnit\Framework\Attributes\DataProvider;
30use PHPUnit\Framework\TestCase;
31
37class InitHttpServicesTest extends TestCase
38{
39 private Container $dic;
40
41 protected function setUp(): void
42 {
43 $this->dic = new Container();
44 }
45
49 public static function servicesItRegisters(): array
50 {
51 return [
52 'request factory' => [RequestFactory::class],
53 'response factory' => [ResponseFactory::class],
54 'cookie jar factory' => [CookieJarFactory::class],
55 'response sender strategy' => [ResponseSenderStrategy::class],
56 'duration factory' => [DurationFactory::class],
57 'http state' => [GlobalHttpState::class],
58 ];
59 }
60
61 #[DataProvider('servicesItRegisters')]
63 {
64 $this->assertFalse(isset($this->dic[$service]));
65
66 (new InitHttpServices())->init($this->dic);
67
68 $this->assertTrue(isset($this->dic[$service]));
69 $this->assertInstanceOf($service, $this->dic[$service]);
70 }
71
73 {
74 (new InitHttpServices())->init($this->dic);
75
76 $this->assertInstanceOf(Services::class, $this->dic['http']);
77 $this->assertSame($this->dic[GlobalHttpState::class], $this->dic['http']);
78 }
79
81 {
82 (new InitHttpServices())->init($this->dic);
83
84 $this->assertInstanceOf(Services::class, $this->dic->http());
85 }
86}
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:38
Class Services.
Definition: Services.php:43
InitHttpServices is the backport bridge that still populates the legacy container for components whic...
testTheContainerOnlyHoldsTheServiceAfterInit(string $service)
testTheLegacyHttpKeyResolvesToTheSameStateAsTheInterface()
Interface GlobalHttpState.
$service
Definition: ltiresult.php:44