Covers the host guard in {.
More...
Covers the host guard in {.
- See also
- LegacyDelivery}: the content domain is reserved for signed token delivery, so legacy delivery must answer 404 there instead of serving the file.
- Author
- Fabian Schmid fabia.nosp@m.n@sr.nosp@m..solu.nosp@m.tion.nosp@m.s
Definition at line 40 of file LegacyDeliveryIsolationTest.php.
◆ activeConfig()
| ILIAS\Tests\FileDelivery\Delivery\LegacyDeliveryIsolationTest::activeConfig |
( |
| ) |
|
|
private |
◆ building()
| ILIAS\Tests\FileDelivery\Delivery\LegacyDeliveryIsolationTest::building |
( |
| ) |
|
|
private |
Definition at line 116 of file LegacyDeliveryIsolationTest.php.
116 : ResponseBuilder
117 {
118 $rb = $this->createMock(ResponseBuilder::class);
119 $rb->method('getName')->willReturn('PHP');
120 $rb->expects($this->once())
121 ->method('buildForStream')
122 ->willReturnCallback(
123 static fn(ServerRequestInterface
$request, ResponseInterface $r): ResponseInterface => $r
124 );
125 return $rb;
126 }
$request
@ilCtrl_Calls ilObjLearningSequenceContentGUI: ilObjLearningSequenceConditionsGUI
References $request.
◆ deliverInline()
| ILIAS\Tests\FileDelivery\Delivery\LegacyDeliveryIsolationTest::deliverInline |
( |
IsolationConfig |
$isolation, |
|
|
string |
$request_host, |
|
|
ResponseBuilder |
$response_builder |
|
) |
| |
|
private |
Definition at line 89 of file LegacyDeliveryIsolationTest.php.
93 : void {
94 $delivery = new LegacyDelivery(
95 $this->
http($request_host),
96 $response_builder,
97 $response_builder,
98 $isolation
99 );
100
101 try {
102 $delivery->inline($this->file);
103 $this->fail('delivery did not terminate');
104 } catch (DeliveryTerminated) {
105
106 }
107 }
http(string $request_host)
References ILIAS\FileDelivery\Delivery\LegacyDelivery\inline().
◆ http()
| ILIAS\Tests\FileDelivery\Delivery\LegacyDeliveryIsolationTest::http |
( |
string |
$request_host | ) |
|
|
private |
Definition at line 58 of file LegacyDeliveryIsolationTest.php.
58 : HttpServices
59 {
60 $uri = $this->createStub(UriInterface::class);
61 $uri->method('getHost')->willReturn($request_host);
62
63 $request = $this->createStub(ServerRequestInterface::class);
64 $request->method(
'getUri')->willReturn($uri);
65
66 $http = $this->createStub(HttpServices::class);
68 $http->method(
'response')->willReturn((
new MessageFactoryImpl())->response());
69 $http->method(
'saveResponse')->willReturnCallback(
70 function (ResponseInterface $r): void {
71 $this->saved = $r;
72 }
73 );
74
75 $http->method(
'close')->willThrowException(
new DeliveryTerminated());
76
78 }
readonly HttpService $http
References ILIAS\BookingManager\Common\Table\$http, and $request.
◆ neverBuilding()
| ILIAS\Tests\FileDelivery\Delivery\LegacyDeliveryIsolationTest::neverBuilding |
( |
| ) |
|
|
private |
Definition at line 109 of file LegacyDeliveryIsolationTest.php.
109 : ResponseBuilder
110 {
111 $rb = $this->createMock(ResponseBuilder::class);
112 $rb->expects($this->never())->method('buildForStream');
113 return $rb;
114 }
◆ setUp()
| ILIAS\Tests\FileDelivery\Delivery\LegacyDeliveryIsolationTest::setUp |
( |
| ) |
|
|
protected |
Definition at line 45 of file LegacyDeliveryIsolationTest.php.
45 : void
46 {
47 $this->file = (string) tempnam(sys_get_temp_dir(), 'fd_iso_');
48 file_put_contents($this->file, 'legacy content');
49 }
◆ tearDown()
| ILIAS\Tests\FileDelivery\Delivery\LegacyDeliveryIsolationTest::tearDown |
( |
| ) |
|
|
protected |
◆ testLegacyDeliveryIsRefusedOnTheContentHost()
| ILIAS\Tests\FileDelivery\Delivery\LegacyDeliveryIsolationTest::testLegacyDeliveryIsRefusedOnTheContentHost |
( |
| ) |
|
Definition at line 128 of file LegacyDeliveryIsolationTest.php.
128 : void
129 {
131
132 $this->assertNotNull($this->saved);
133 $this->assertSame(404, $this->saved->getStatusCode());
134 }
deliverInline(IsolationConfig $isolation, string $request_host, ResponseBuilder $response_builder)
◆ testLegacyDeliveryIsRefusedOnTheContentHostRegardlessOfCase()
| ILIAS\Tests\FileDelivery\Delivery\LegacyDeliveryIsolationTest::testLegacyDeliveryIsRefusedOnTheContentHostRegardlessOfCase |
( |
| ) |
|
Definition at line 136 of file LegacyDeliveryIsolationTest.php.
136 : void
137 {
139
140 $this->assertNotNull($this->saved);
141 $this->assertSame(404, $this->saved->getStatusCode());
142 }
◆ testLegacyDeliveryIsServedOnAnyHostWhenIsolationIsDisabled()
| ILIAS\Tests\FileDelivery\Delivery\LegacyDeliveryIsolationTest::testLegacyDeliveryIsServedOnAnyHostWhenIsolationIsDisabled |
( |
| ) |
|
◆ testLegacyDeliveryIsServedOnTheIliasHost()
| ILIAS\Tests\FileDelivery\Delivery\LegacyDeliveryIsolationTest::testLegacyDeliveryIsServedOnTheIliasHost |
( |
| ) |
|
Definition at line 144 of file LegacyDeliveryIsolationTest.php.
144 : void
145 {
147
148 $this->assertNotNull($this->saved);
149 $this->assertSame(200, $this->saved->getStatusCode());
150
151 $this->assertSame('nosniff', $this->saved->getHeaderLine('X-Content-Type-Options'));
152 $this->assertSame(
153 'https://app.example.org',
154 $this->saved->getHeaderLine('Access-Control-Allow-Origin')
155 );
156 }
◆ $file
| string ILIAS\Tests\FileDelivery\Delivery\LegacyDeliveryIsolationTest::$file |
|
private |
◆ $saved
| ResponseInterface ILIAS\Tests\FileDelivery\Delivery\LegacyDeliveryIsolationTest::$saved = null |
|
private |
The documentation for this class was generated from the following file: