ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
ILIAS\HTTP\Request\RequestFactoryImplTest Class Reference
+ Inheritance diagram for ILIAS\HTTP\Request\RequestFactoryImplTest:
+ Collaboration diagram for ILIAS\HTTP\Request\RequestFactoryImplTest:

Public Member Functions

 testSchemeStaysUntouchedWithoutConfiguration ()
 
 testSchemeStaysUntouchedIfHeaderDoesNotMatch ()
 
 testSchemeIsHttpsIfHeaderMatches ()
 
 testSchemeIsHttpsForHeaderValuesWhichAreNoProtocol ()
 The configured header value describes when https is in use, it is not the protocol itself - see https://mantis.ilias.de/view.php?id=45344. More...
 
 testSchemeIsHttpsForHeaderNamesConfiguredWithUnderscores ()
 

Protected Member Functions

 setUp ()
 
 tearDown ()
 

Private Member Functions

 factoryFor (?string $header_name, ?string $header_value)
 

Private Attributes

array $server_backup
 

Detailed Description

Member Function Documentation

◆ factoryFor()

ILIAS\HTTP\Request\RequestFactoryImplTest::factoryFor ( ?string  $header_name,
?string  $header_value 
)
private

Definition at line 49 of file RequestFactoryImplTest.php.

49 : RequestFactoryImpl
50 {
51 return new RequestFactoryImpl(
52 new class ($header_name, $header_value) implements HeaderSettings {
53 public function __construct(
54 private readonly ?string $header_name,
55 private readonly ?string $header_value
56 ) {
57 }
58
59 public function isHTTPSDetectionEnabled(): bool
60 {
61 return $this->header_name !== null && $this->header_value !== null;
62 }
63
64 public function getHTTPDetectionHeaderName(): ?string
65 {
66 return $this->header_name;
67 }
68
69 public function getHTTPDetectionHeaderValue(): ?string
70 {
71 return $this->header_value;
72 }
73 }
74 );
75 }
__construct()
Constructor setup ILIAS global object @access public.
Definition: class.ilias.php:76

References ILIAS\__construct().

Referenced by ILIAS\HTTP\Request\RequestFactoryImplTest\testSchemeIsHttpsForHeaderNamesConfiguredWithUnderscores(), ILIAS\HTTP\Request\RequestFactoryImplTest\testSchemeIsHttpsForHeaderValuesWhichAreNoProtocol(), ILIAS\HTTP\Request\RequestFactoryImplTest\testSchemeIsHttpsIfHeaderMatches(), ILIAS\HTTP\Request\RequestFactoryImplTest\testSchemeStaysUntouchedIfHeaderDoesNotMatch(), and ILIAS\HTTP\Request\RequestFactoryImplTest\testSchemeStaysUntouchedWithoutConfiguration().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setUp()

ILIAS\HTTP\Request\RequestFactoryImplTest::setUp ( )
protected

Definition at line 32 of file RequestFactoryImplTest.php.

32 : void
33 {
35 $this->server_backup = $_SERVER;
36
37 $_SERVER['REQUEST_METHOD'] = 'GET';
38 $_SERVER['HTTP_HOST'] = 'ilias.example.com';
39 $_SERVER['REQUEST_URI'] = '/ilias.php';
40 unset($_SERVER['HTTPS']);
41 }

References setUp().

+ Here is the call graph for this function:

◆ tearDown()

ILIAS\HTTP\Request\RequestFactoryImplTest::tearDown ( )
protected

Definition at line 43 of file RequestFactoryImplTest.php.

References ILIAS\HTTP\Request\RequestFactoryImplTest\$server_backup, and tearDown().

+ Here is the call graph for this function:

◆ testSchemeIsHttpsForHeaderNamesConfiguredWithUnderscores()

ILIAS\HTTP\Request\RequestFactoryImplTest::testSchemeIsHttpsForHeaderNamesConfiguredWithUnderscores ( )

Definition at line 113 of file RequestFactoryImplTest.php.

113 : void
114 {
115 $_SERVER['HTTP_FRONT_END_HTTPS'] = 'on';
116
117 $factory = $this->factoryFor('FRONT_END_HTTPS', 'on');
118
119 $this->assertSame('https', $factory->create()->getUri()->getScheme());
120 }
factoryFor(?string $header_name, ?string $header_value)

References ILIAS\HTTP\Request\RequestFactoryImplTest\factoryFor().

+ Here is the call graph for this function:

◆ testSchemeIsHttpsForHeaderValuesWhichAreNoProtocol()

ILIAS\HTTP\Request\RequestFactoryImplTest::testSchemeIsHttpsForHeaderValuesWhichAreNoProtocol ( )

The configured header value describes when https is in use, it is not the protocol itself - see https://mantis.ilias.de/view.php?id=45344.

Definition at line 104 of file RequestFactoryImplTest.php.

104 : void
105 {
106 $_SERVER['HTTP_FRONT_END_HTTPS'] = 'on';
107
108 $factory = $this->factoryFor('FRONT-END-HTTPS', 'on');
109
110 $this->assertSame('https', $factory->create()->getUri()->getScheme());
111 }

References ILIAS\HTTP\Request\RequestFactoryImplTest\factoryFor().

+ Here is the call graph for this function:

◆ testSchemeIsHttpsIfHeaderMatches()

ILIAS\HTTP\Request\RequestFactoryImplTest::testSchemeIsHttpsIfHeaderMatches ( )

Definition at line 91 of file RequestFactoryImplTest.php.

91 : void
92 {
93 $_SERVER['HTTP_X_FORWARDED_PROTO'] = 'https';
94
95 $factory = $this->factoryFor('X-Forwarded-Proto', 'https');
96
97 $this->assertSame('https', $factory->create()->getUri()->getScheme());
98 }

References ILIAS\HTTP\Request\RequestFactoryImplTest\factoryFor().

+ Here is the call graph for this function:

◆ testSchemeStaysUntouchedIfHeaderDoesNotMatch()

ILIAS\HTTP\Request\RequestFactoryImplTest::testSchemeStaysUntouchedIfHeaderDoesNotMatch ( )

Definition at line 82 of file RequestFactoryImplTest.php.

82 : void
83 {
84 $_SERVER['HTTP_X_FORWARDED_PROTO'] = 'http';
85
86 $factory = $this->factoryFor('X-Forwarded-Proto', 'https');
87
88 $this->assertSame('http', $factory->create()->getUri()->getScheme());
89 }

References ILIAS\HTTP\Request\RequestFactoryImplTest\factoryFor().

+ Here is the call graph for this function:

◆ testSchemeStaysUntouchedWithoutConfiguration()

ILIAS\HTTP\Request\RequestFactoryImplTest::testSchemeStaysUntouchedWithoutConfiguration ( )

Definition at line 77 of file RequestFactoryImplTest.php.

77 : void
78 {
79 $this->assertSame('http', $this->factoryFor(null, null)->create()->getUri()->getScheme());
80 }

References ILIAS\HTTP\Request\RequestFactoryImplTest\factoryFor().

+ Here is the call graph for this function:

Field Documentation

◆ $server_backup

array ILIAS\HTTP\Request\RequestFactoryImplTest::$server_backup
private

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