ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
ILIAS\Tests\FileDelivery\ServicesBaseUriTest Class Reference
+ Inheritance diagram for ILIAS\Tests\FileDelivery\ServicesBaseUriTest:
+ Collaboration diagram for ILIAS\Tests\FileDelivery\ServicesBaseUriTest:

Public Member Functions

 testUsesRequestHostWhenIsolationDisabled ()
 
 testKeepsPortWhenIsolationDisabled ()
 
 testRewritesToContentDomainWhenIsolationActive ()
 
 testContentDomainRewriteIgnoresRequestHostAndPort ()
 
 testStaysOnRequestHostWithoutIsolationWhenIsolationActive ()
 

Private Member Functions

 services (IsolationConfig $isolation, string $scheme='https', string $host='app.example.org', ?int $port=null, string $path='/data/deliver.php')
 
 activeConfig ()
 

Detailed Description

Author
Fabian Schmid fabia.nosp@m.n@sr.nosp@m..solu.nosp@m.tion.nosp@m.s

Definition at line 40 of file ServicesBaseUriTest.php.

Member Function Documentation

◆ activeConfig()

◆ services()

ILIAS\Tests\FileDelivery\ServicesBaseUriTest::services ( IsolationConfig  $isolation,
string  $scheme = 'https',
string  $host = 'app.example.org',
?int  $port = null,
string  $path = '/data/deliver.php' 
)
private

Definition at line 42 of file ServicesBaseUriTest.php.

48 : object {
49 $uri = $this->createStub(UriInterface::class);
50 $uri->method('getScheme')->willReturn($scheme);
51 $uri->method('getHost')->willReturn($host);
52 $uri->method('getPort')->willReturn($port);
53 $uri->method('getPath')->willReturn($path);
54
55 $request = $this->createStub(ServerRequestInterface::class);
56 $request->method('getUri')->willReturn($uri);
57
58 $http = $this->createStub(HttpServices::class);
59 $http->method('request')->willReturn($request);
60
61 $data_signer = new DataSigner(new SecretKeyRotation(new SecretKey('test_key')), new SHA1());
62 $rb = $this->createStub(ResponseBuilder::class);
63
64 // the inner deliveries are required by the constructor but unused by getBaseURI
65 $stream = new StreamDelivery($data_signer, $http, $rb, $rb, IsolationConfig::disabled());
66 $legacy = new LegacyDelivery($http, $rb, $rb, IsolationConfig::disabled());
67
68 return new class ($stream, $legacy, $data_signer, $http, $isolation) extends Services {
69 public function exposedBaseURI(bool $isolated = true): string
70 {
71 return $this->getBaseURI($isolated);
72 }
73 };
74 }
$request
@ilCtrl_Calls ilObjLearningSequenceContentGUI: ilObjLearningSequenceConditionsGUI
Definition: ltiauth.php:39

◆ testContentDomainRewriteIgnoresRequestHostAndPort()

ILIAS\Tests\FileDelivery\ServicesBaseUriTest::testContentDomainRewriteIgnoresRequestHostAndPort ( )

Definition at line 103 of file ServicesBaseUriTest.php.

103 : void
104 {
105 // even if the request arrives on a different host/port, the content
106 // domain is authoritative for the asset base URI
107 $services = $this->services($this->activeConfig(), 'http', 'whatever.example.org', 1234);
108 $this->assertSame('https://content.example.org/data', $services->exposedBaseURI());
109 }
services(IsolationConfig $isolation, string $scheme='https', string $host='app.example.org', ?int $port=null, string $path='/data/deliver.php')

◆ testKeepsPortWhenIsolationDisabled()

ILIAS\Tests\FileDelivery\ServicesBaseUriTest::testKeepsPortWhenIsolationDisabled ( )

Definition at line 91 of file ServicesBaseUriTest.php.

91 : void
92 {
93 $services = $this->services(IsolationConfig::disabled(), 'https', 'app.example.org', 8443);
94 $this->assertSame('https://app.example.org:8443/data', $services->exposedBaseURI());
95 }

References ILIAS\FileDelivery\Isolation\IsolationConfig\disabled().

+ Here is the call graph for this function:

◆ testRewritesToContentDomainWhenIsolationActive()

ILIAS\Tests\FileDelivery\ServicesBaseUriTest::testRewritesToContentDomainWhenIsolationActive ( )

Definition at line 97 of file ServicesBaseUriTest.php.

97 : void
98 {
99 $services = $this->services($this->activeConfig());
100 $this->assertSame('https://content.example.org/data', $services->exposedBaseURI());
101 }

◆ testStaysOnRequestHostWithoutIsolationWhenIsolationActive()

ILIAS\Tests\FileDelivery\ServicesBaseUriTest::testStaysOnRequestHostWithoutIsolationWhenIsolationActive ( )

Definition at line 111 of file ServicesBaseUriTest.php.

111 : void
112 {
113 $services = $this->services($this->activeConfig(), 'https', 'app.example.org', 8443);
114 $this->assertSame('https://app.example.org:8443/data', $services->exposedBaseURI(false));
115 // the isolated base URI is not affected by an earlier call without isolation
116 $this->assertSame('https://content.example.org/data', $services->exposedBaseURI());
117 }

◆ testUsesRequestHostWhenIsolationDisabled()

ILIAS\Tests\FileDelivery\ServicesBaseUriTest::testUsesRequestHostWhenIsolationDisabled ( )

Definition at line 85 of file ServicesBaseUriTest.php.

85 : void
86 {
87 $services = $this->services(IsolationConfig::disabled());
88 $this->assertSame('https://app.example.org/data', $services->exposedBaseURI());
89 }

References ILIAS\FileDelivery\Isolation\IsolationConfig\disabled().

+ Here is the call graph for this function:

The documentation for this class was generated from the following file: