ILIAS  trunk Revision v12.0_alpha-1541-g23eaa5e013d
ILIAS\WebDAV\Tests\Request\RequestTranslationTest Class Reference
+ Inheritance diagram for ILIAS\WebDAV\Tests\Request\RequestTranslationTest:
+ Collaboration diagram for ILIAS\WebDAV\Tests\Request\RequestTranslationTest:

Public Member Functions

 getRequestedPath_withClientSegment_isStripped ()
 
 getRequestedPath_withoutClientSegment_isReturnedAsIs ()
 
 getRequestedPath_endpointOnly_returnsEmpty ()
 
 getRequestedPath_clientLooksLikeRef_isNotStripped ()
 
 getRequestedPathAsArray_splitsOnSlashes ()
 
 getBasePath_withClientSegment_includesClientId ()
 
 getBasePath_withoutClientSegment_excludesClientId ()
 
 getBasePath_emptyClientId_excludesClientCheck ()
 
 showMountPoint_queryParamPresent_returnsTrue ()
 
 showMountPoint_queryParamMissing_returnsFalse ()
 

Private Member Functions

 buildRequest (string $path, array $query_params=[])
 
 buildConfig (string $client_id='default')
 

Detailed Description

Definition at line 32 of file RequestTranslationTest.php.

Member Function Documentation

◆ buildConfig()

ILIAS\WebDAV\Tests\Request\RequestTranslationTest::buildConfig ( string  $client_id = 'default')
private

Definition at line 46 of file RequestTranslationTest.php.

46 : Config
47 {
48 return new class ($client_id) extends Config {
49 public function __construct(private string $client)
50 {
51 }
52 public function getClientId(): string
53 {
54 return $this->client;
55 }
56 };
57 }
string $client_id
Definition: class.ilias.php:36
__construct()
Constructor setup ILIAS global object @access public.
Definition: class.ilias.php:76
getClientId()
$client

References $client, ILIAS\$client_id, ILIAS\__construct(), and ILIAS\getClientId().

Referenced by ILIAS\WebDAV\Tests\Request\RequestTranslationTest\getBasePath_emptyClientId_excludesClientCheck(), ILIAS\WebDAV\Tests\Request\RequestTranslationTest\getBasePath_withClientSegment_includesClientId(), ILIAS\WebDAV\Tests\Request\RequestTranslationTest\getBasePath_withoutClientSegment_excludesClientId(), ILIAS\WebDAV\Tests\Request\RequestTranslationTest\getRequestedPath_clientLooksLikeRef_isNotStripped(), ILIAS\WebDAV\Tests\Request\RequestTranslationTest\getRequestedPath_endpointOnly_returnsEmpty(), ILIAS\WebDAV\Tests\Request\RequestTranslationTest\getRequestedPath_withClientSegment_isStripped(), ILIAS\WebDAV\Tests\Request\RequestTranslationTest\getRequestedPath_withoutClientSegment_isReturnedAsIs(), ILIAS\WebDAV\Tests\Request\RequestTranslationTest\getRequestedPathAsArray_splitsOnSlashes(), ILIAS\WebDAV\Tests\Request\RequestTranslationTest\showMountPoint_queryParamMissing_returnsFalse(), and ILIAS\WebDAV\Tests\Request\RequestTranslationTest\showMountPoint_queryParamPresent_returnsTrue().

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

◆ buildRequest()

ILIAS\WebDAV\Tests\Request\RequestTranslationTest::buildRequest ( string  $path,
array  $query_params = [] 
)
private

Definition at line 34 of file RequestTranslationTest.php.

34 : ServerRequestInterface
35 {
36 $uri = $this->createStub(UriInterface::class);
37 $uri->method('getPath')->willReturn($path);
38
39 $request = $this->createStub(ServerRequestInterface::class);
40 $request->method('getUri')->willReturn($uri);
41 $request->method('getQueryParams')->willReturn($query_params);
42
43 return $request;
44 }
$path
Definition: ltiservices.php:30

References $path.

Referenced by ILIAS\WebDAV\Tests\Request\RequestTranslationTest\getBasePath_emptyClientId_excludesClientCheck(), ILIAS\WebDAV\Tests\Request\RequestTranslationTest\getBasePath_withClientSegment_includesClientId(), ILIAS\WebDAV\Tests\Request\RequestTranslationTest\getBasePath_withoutClientSegment_excludesClientId(), ILIAS\WebDAV\Tests\Request\RequestTranslationTest\getRequestedPath_clientLooksLikeRef_isNotStripped(), ILIAS\WebDAV\Tests\Request\RequestTranslationTest\getRequestedPath_endpointOnly_returnsEmpty(), ILIAS\WebDAV\Tests\Request\RequestTranslationTest\getRequestedPath_withClientSegment_isStripped(), ILIAS\WebDAV\Tests\Request\RequestTranslationTest\getRequestedPath_withoutClientSegment_isReturnedAsIs(), ILIAS\WebDAV\Tests\Request\RequestTranslationTest\getRequestedPathAsArray_splitsOnSlashes(), ILIAS\WebDAV\Tests\Request\RequestTranslationTest\showMountPoint_queryParamMissing_returnsFalse(), and ILIAS\WebDAV\Tests\Request\RequestTranslationTest\showMountPoint_queryParamPresent_returnsTrue().

+ Here is the caller graph for this function:

◆ getBasePath_emptyClientId_excludesClientCheck()

ILIAS\WebDAV\Tests\Request\RequestTranslationTest::getBasePath_emptyClientId_excludesClientCheck ( )

Definition at line 141 of file RequestTranslationTest.php.

141 : void
142 {
143 $translation = new RequestTranslation(
144 $this->buildConfig(''),
145 $this->buildRequest('/webdav.php/default/ref_92')
146 );
147
148 $this->assertSame('/webdav.php/', $translation->getBasePath());
149 }
buildRequest(string $path, array $query_params=[])

References ILIAS\WebDAV\Tests\Request\RequestTranslationTest\buildConfig(), and ILIAS\WebDAV\Tests\Request\RequestTranslationTest\buildRequest().

+ Here is the call graph for this function:

◆ getBasePath_withClientSegment_includesClientId()

ILIAS\WebDAV\Tests\Request\RequestTranslationTest::getBasePath_withClientSegment_includesClientId ( )

Definition at line 119 of file RequestTranslationTest.php.

119 : void
120 {
121 $translation = new RequestTranslation(
122 $this->buildConfig('default'),
123 $this->buildRequest('/webdav.php/default/ref_92')
124 );
125
126 $this->assertSame('/webdav.php/default/', $translation->getBasePath());
127 }

References ILIAS\WebDAV\Tests\Request\RequestTranslationTest\buildConfig(), and ILIAS\WebDAV\Tests\Request\RequestTranslationTest\buildRequest().

+ Here is the call graph for this function:

◆ getBasePath_withoutClientSegment_excludesClientId()

ILIAS\WebDAV\Tests\Request\RequestTranslationTest::getBasePath_withoutClientSegment_excludesClientId ( )

Definition at line 130 of file RequestTranslationTest.php.

130 : void
131 {
132 $translation = new RequestTranslation(
133 $this->buildConfig('default'),
134 $this->buildRequest('/webdav.php/ref_92')
135 );
136
137 $this->assertSame('/webdav.php/', $translation->getBasePath());
138 }

References ILIAS\WebDAV\Tests\Request\RequestTranslationTest\buildConfig(), and ILIAS\WebDAV\Tests\Request\RequestTranslationTest\buildRequest().

+ Here is the call graph for this function:

◆ getRequestedPath_clientLooksLikeRef_isNotStripped()

ILIAS\WebDAV\Tests\Request\RequestTranslationTest::getRequestedPath_clientLooksLikeRef_isNotStripped ( )

Definition at line 93 of file RequestTranslationTest.php.

93 : void
94 {
95 // ensure that "ref_92" is never accidentally treated as a client segment
96 $translation = new RequestTranslation(
97 $this->buildConfig('default'),
98 $this->buildRequest('/webdav.php/ref_92')
99 );
100
101 $this->assertSame('ref_92', $translation->getRequestedPath());
102 }

References ILIAS\WebDAV\Tests\Request\RequestTranslationTest\buildConfig(), and ILIAS\WebDAV\Tests\Request\RequestTranslationTest\buildRequest().

+ Here is the call graph for this function:

◆ getRequestedPath_endpointOnly_returnsEmpty()

ILIAS\WebDAV\Tests\Request\RequestTranslationTest::getRequestedPath_endpointOnly_returnsEmpty ( )

Definition at line 82 of file RequestTranslationTest.php.

82 : void
83 {
84 $translation = new RequestTranslation(
85 $this->buildConfig('default'),
86 $this->buildRequest('/webdav.php/')
87 );
88
89 $this->assertSame('', $translation->getRequestedPath());
90 }

References ILIAS\WebDAV\Tests\Request\RequestTranslationTest\buildConfig(), and ILIAS\WebDAV\Tests\Request\RequestTranslationTest\buildRequest().

+ Here is the call graph for this function:

◆ getRequestedPath_withClientSegment_isStripped()

ILIAS\WebDAV\Tests\Request\RequestTranslationTest::getRequestedPath_withClientSegment_isStripped ( )

Definition at line 60 of file RequestTranslationTest.php.

60 : void
61 {
62 $translation = new RequestTranslation(
63 $this->buildConfig('default'),
64 $this->buildRequest('/webdav.php/default/ref_92/sub/file.txt')
65 );
66
67 $this->assertSame('ref_92/sub/file.txt', $translation->getRequestedPath());
68 }

References ILIAS\WebDAV\Tests\Request\RequestTranslationTest\buildConfig(), and ILIAS\WebDAV\Tests\Request\RequestTranslationTest\buildRequest().

+ Here is the call graph for this function:

◆ getRequestedPath_withoutClientSegment_isReturnedAsIs()

ILIAS\WebDAV\Tests\Request\RequestTranslationTest::getRequestedPath_withoutClientSegment_isReturnedAsIs ( )

Definition at line 71 of file RequestTranslationTest.php.

71 : void
72 {
73 $translation = new RequestTranslation(
74 $this->buildConfig('default'),
75 $this->buildRequest('/webdav.php/ref_92/sub/file.txt')
76 );
77
78 $this->assertSame('ref_92/sub/file.txt', $translation->getRequestedPath());
79 }

References ILIAS\WebDAV\Tests\Request\RequestTranslationTest\buildConfig(), and ILIAS\WebDAV\Tests\Request\RequestTranslationTest\buildRequest().

+ Here is the call graph for this function:

◆ getRequestedPathAsArray_splitsOnSlashes()

ILIAS\WebDAV\Tests\Request\RequestTranslationTest::getRequestedPathAsArray_splitsOnSlashes ( )

Definition at line 105 of file RequestTranslationTest.php.

105 : void
106 {
107 $translation = new RequestTranslation(
108 $this->buildConfig('default'),
109 $this->buildRequest('/webdav.php/ref_92/folder/file.txt')
110 );
111
112 $this->assertSame(
113 ['ref_92', 'folder', 'file.txt'],
114 $translation->getRequestedPathAsArray()
115 );
116 }

References ILIAS\WebDAV\Tests\Request\RequestTranslationTest\buildConfig(), and ILIAS\WebDAV\Tests\Request\RequestTranslationTest\buildRequest().

+ Here is the call graph for this function:

◆ showMountPoint_queryParamMissing_returnsFalse()

ILIAS\WebDAV\Tests\Request\RequestTranslationTest::showMountPoint_queryParamMissing_returnsFalse ( )

Definition at line 163 of file RequestTranslationTest.php.

163 : void
164 {
165 $translation = new RequestTranslation(
166 $this->buildConfig('default'),
167 $this->buildRequest('/webdav.php/ref_92', [])
168 );
169
170 $this->assertFalse($translation->showMountPoint());
171 }

References ILIAS\WebDAV\Tests\Request\RequestTranslationTest\buildConfig(), and ILIAS\WebDAV\Tests\Request\RequestTranslationTest\buildRequest().

+ Here is the call graph for this function:

◆ showMountPoint_queryParamPresent_returnsTrue()

ILIAS\WebDAV\Tests\Request\RequestTranslationTest::showMountPoint_queryParamPresent_returnsTrue ( )

Definition at line 152 of file RequestTranslationTest.php.

152 : void
153 {
154 $translation = new RequestTranslation(
155 $this->buildConfig('default'),
156 $this->buildRequest('/webdav.php/ref_92', ['mount-instructions' => ''])
157 );
158
159 $this->assertTrue($translation->showMountPoint());
160 }

References ILIAS\WebDAV\Tests\Request\RequestTranslationTest\buildConfig(), and ILIAS\WebDAV\Tests\Request\RequestTranslationTest\buildRequest().

+ Here is the call graph for this function:

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