]> git.mxchange.org Git - friendica.git/blob - tests/src/Util/BaseURLTest.php
Reduce config->set() load for worker executions
[friendica.git] / tests / src / Util / BaseURLTest.php
1 <?php
2 /**
3  * @copyright Copyright (C) 2010-2023, the Friendica project
4  *
5  * @license GNU AGPL version 3 or any later version
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU Affero General Public License as
9  * published by the Free Software Foundation, either version 3 of the
10  * License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU Affero General Public License for more details.
16  *
17  * You should have received a copy of the GNU Affero General Public License
18  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
19  *
20  */
21
22 namespace Friendica\Test\src\Util;
23
24 use Friendica\App\BaseURL;
25 use Friendica\Core\Config\Capability\IManageConfigValues;
26 use Friendica\Test\MockedTest;
27
28 class BaseURLTest extends MockedTest
29 {
30         public function dataDefault()
31         {
32                 return [
33                         'null' => [
34                                 'server' => [],
35                                 'input' => [
36                                 'hostname' => null,
37                                 'urlPath' => null,
38                                 'sslPolicy' => null,
39                                 'url' => null,
40                                         ],
41                                 'assert' => [
42                                         'hostname'  => '',
43                                         'urlPath'   => '',
44                                         'sslPolicy' => BaseURL::DEFAULT_SSL_SCHEME,
45                                         'url'       => 'http://',
46                                         'scheme'    => 'http',
47                                 ],
48                         ],
49                         'WithSubDirectory' => [
50                                 'server' => [
51                                         'SERVER_NAME'  => 'friendica.local',
52                                         'REDIRECT_URI' => 'test/module/more',
53                                         'QUERY_STRING' => 'module/more',
54                                 ],
55                                 'input' => [
56                                         'hostname'  => null,
57                                         'urlPath'   => null,
58                                         'sslPolicy' => null,
59                                         'url'       => null,
60                                 ],
61                                 'assert' => [
62                                         'hostname'  => 'friendica.local',
63                                         'urlPath'   => 'test',
64                                         'sslPolicy' => BaseURL::DEFAULT_SSL_SCHEME,
65                                         'url'       => 'http://friendica.local/test',
66                                         'scheme'    => 'http',
67                                 ],
68                         ],
69                         'input' => [
70                                 'server' => [],
71                                 'input' => [
72                                         'hostname'  => 'friendica.local',
73                                         'urlPath'   => 'test',
74                                         'sslPolicy' => BaseURL::SSL_POLICY_FULL,
75                                         'url'       => 'http://friendica.local/test',
76                                 ],
77                                 'assert' => [
78                                         'hostname'  => 'friendica.local',
79                                         'urlPath'   => 'test',
80                                         'sslPolicy' => BaseURL::SSL_POLICY_FULL,
81                                         'url'       => 'http://friendica.local/test',
82                                         'scheme'    => 'http',
83                                 ],
84                         ],
85                         'WithHttpsScheme' => [
86                                 'server' => [
87                                         'SERVER_NAME'    => 'friendica.local',
88                                         'REDIRECT_URI'   => 'test/module/more',
89                                         'QUERY_STRING'   => 'module/more',
90                                         'HTTPS'          => true,
91                                 ],
92                                 'input' => [
93                                         'hostname'  => null,
94                                         'urlPath'   => null,
95                                         'sslPolicy' => null,
96                                         'url'       => null,
97                                 ],
98                                 'assert' => [
99                                         'hostname'  => 'friendica.local',
100                                         'urlPath'   => 'test',
101                                         'sslPolicy' => BaseURL::SSL_POLICY_FULL,
102                                         'url'       => 'https://friendica.local/test',
103                                         'scheme'    => 'https',
104                                 ],
105                         ],
106                         'WithoutQueryString' => [
107                                 'server' => [
108                                         'SERVER_NAME'    => 'friendica.local',
109                                         'REDIRECT_URI'   => 'test/more',
110                                         'HTTPS'          => true,
111                                 ],
112                                 'input' => [
113                                         'hostname'  => null,
114                                         'urlPath'   => null,
115                                         'sslPolicy' => null,
116                                         'url'       => null,
117                                 ],
118                                 'assert' => [
119                                         'hostname'  => 'friendica.local',
120                                         'urlPath'   => 'test/more',
121                                         'sslPolicy' => BaseURL::SSL_POLICY_FULL,
122                                         'url'       => 'https://friendica.local/test/more',
123                                         'scheme'    => 'https',
124                                 ],
125                         ],
126                         'WithPort' => [
127                                 'server' => [
128                                         'SERVER_NAME'    => 'friendica.local',
129                                         'SERVER_PORT'    => '1234',
130                                         'REDIRECT_URI'   => 'test/more',
131                                         'HTTPS'          => true,
132                                 ],
133                                 'input' => [
134                                         'hostname'  => null,
135                                         'urlPath'   => null,
136                                         'sslPolicy' => null,
137                                         'url'       => null,
138                                 ],
139                                 'assert' => [
140                                         'hostname'  => 'friendica.local:1234',
141                                         'urlPath'   => 'test/more',
142                                         'sslPolicy' => BaseURL::SSL_POLICY_FULL,
143                                         'url'       => 'https://friendica.local:1234/test/more',
144                                         'scheme'    => 'https',
145                                 ],
146                         ],
147                         'With443Port' => [
148                                 'server' => [
149                                         'SERVER_NAME'    => 'friendica.local',
150                                         'SERVER_PORT'    => '443',
151                                         'REDIRECT_URI'   => 'test/more',
152                                 ],
153                                 'input' => [
154                                         'hostname'  => null,
155                                         'urlPath'   => null,
156                                         'sslPolicy' => null,
157                                         'url'       => null,
158                                 ],
159                                 'assert' => [
160                                         'hostname'  => 'friendica.local',
161                                         'urlPath'   => 'test/more',
162                                         'sslPolicy' => BaseURL::SSL_POLICY_FULL,
163                                         'url'       => 'https://friendica.local/test/more',
164                                         'scheme'    => 'https',
165                                 ],
166                         ],
167                         'With80Port' => [
168                                 'server' => [
169                                         'SERVER_NAME'  => 'friendica.local',
170                                         'SERVER_PORT'  => '80',
171                                         'REDIRECT_URI' => 'test/more',
172                                 ],
173                                 'input' => [
174                                         'hostname'  => null,
175                                         'urlPath'   => null,
176                                         'sslPolicy' => null,
177                                         'url'       => null,
178                                 ],
179                                 'assert' => [
180                                         'hostname'  => 'friendica.local',
181                                         'urlPath'   => 'test/more',
182                                         'sslPolicy' => BaseURL::DEFAULT_SSL_SCHEME,
183                                         'url'       => 'http://friendica.local/test/more',
184                                         'scheme'    => 'http',
185                                 ],
186                         ],
187                 ];
188         }
189
190         /**
191          * Test the default config determination
192          * @dataProvider dataDefault
193          */
194         public function testCheck($server, $input, $assert)
195         {
196                 $configMock = \Mockery::mock(IManageConfigValues::class);
197                 $configMock->shouldReceive('get')->with('config', 'hostname')->andReturn($input['hostname']);
198                 $configMock->shouldReceive('get')->with('system', 'urlpath')->andReturn($input['urlPath']);
199                 $configMock->shouldReceive('get')->with('system', 'ssl_policy')->andReturn($input['sslPolicy']);
200                 $configMock->shouldReceive('get')->with('system', 'url')->andReturn($input['url']);
201
202                 // If we don't have an urlPath as an input, we assert it, we will save it to the DB for the next time
203                 if (!isset($input['urlPath']) && isset($assert['urlPath'])) {
204                         $configMock->shouldReceive('set')->with('system', 'urlpath', $assert['urlPath'])->once();
205                 }
206
207                 // If we don't have the ssl_policy as an input, we assert it, we will save it to the DB for the next time
208                 if (!isset($input['sslPolicy']) && isset($assert['sslPolicy'])) {
209                         $configMock->shouldReceive('set')->with('system', 'ssl_policy', $assert['sslPolicy'])->once();
210                 }
211
212                 // If we don't have the hostname as an input, we assert it, we will save it to the DB for the next time
213                 if (empty($input['hostname']) && !empty($assert['hostname'])) {
214                         $configMock->shouldReceive('set')->with('config', 'hostname', $assert['hostname'])->once();
215                 }
216
217                 // If we don't have an URL at first, but we assert it, we will save it to the DB for the next time
218                 if (empty($input['url']) && !empty($assert['url'])) {
219                         $configMock->shouldReceive('set')->with('system', 'url', $assert['url'])->once();
220                 }
221
222                 $baseUrl = new BaseURL($configMock, $server);
223
224                 self::assertEquals($assert['hostname'], $baseUrl->getHostname());
225                 self::assertEquals($assert['urlPath'], $baseUrl->getUrlPath());
226                 self::assertEquals($assert['sslPolicy'], $baseUrl->getSSLPolicy());
227                 self::assertEquals($assert['scheme'], $baseUrl->getScheme());
228                 self::assertEquals($assert['url'], $baseUrl->get());
229         }
230
231         public function dataSave()
232         {
233                 return [
234                         'no_change' => [
235                                 'input' => [
236                                         'hostname'  => 'friendica.local',
237                                         'urlPath'   => 'path',
238                                         'sslPolicy' => BaseURL::SSL_POLICY_FULL,
239                                         'url'       => 'https://friendica.local/path',
240                                         'force_ssl' => true,
241                                 ],
242                                 'save' => [
243                                         'hostname'  => 'friendica.local',
244                                         'urlPath'   => 'path',
245                                         'sslPolicy' => BaseURL::SSL_POLICY_FULL,
246                                 ],
247                                 'url' => 'https://friendica.local/path',
248                         ],
249                         'default' => [
250                                 'input' => [
251                                         'hostname'  => 'friendica.old',
252                                         'urlPath'   => 'is/old/path',
253                                         'sslPolicy' => BaseURL::DEFAULT_SSL_SCHEME,
254                                         'url'       => 'http://friendica.old/is/old/path',
255                                         'force_ssl' => true,
256                                 ],
257                                 'save' => [
258                                         'hostname'  => 'friendica.local',
259                                         'urlPath'   => 'new/path',
260                                         'sslPolicy' => BaseURL::SSL_POLICY_FULL,
261                                 ],
262                                 'url' => 'https://friendica.local/new/path',
263                         ],
264                         'null' => [
265                                 'input' => [
266                                         'hostname'  => 'friendica.old',
267                                         'urlPath'   => 'is/old/path',
268                                         'sslPolicy' => BaseURL::DEFAULT_SSL_SCHEME,
269                                         'url'       => 'http://friendica.old/is/old/path',
270                                         'force_ssl' => true,
271                                 ],
272                                 'save' => [
273                                         'hostname'  => null,
274                                         'urlPath'   => null,
275                                         'sslPolicy' => null,
276                                 ],
277                                 'url' => 'http://friendica.old/is/old/path',
278                         ],
279                         'changeHostname' => [
280                                 'input' => [
281                                         'hostname'  => 'friendica.old',
282                                         'urlPath'   => 'is/old/path',
283                                         'sslPolicy' => BaseURL::DEFAULT_SSL_SCHEME,
284                                         'url'       => 'http://friendica.old/is/old/path',
285                                         'force_ssl' => true,
286                                 ],
287                                 'save' => [
288                                         'hostname'  => 'friendica.local',
289                                         'urlPath'   => null,
290                                         'sslPolicy' => null,
291                                 ],
292                                 'url' => 'http://friendica.local/is/old/path',
293                         ],
294                         'changeUrlPath' => [
295                                 'input' => [
296                                         'hostname'  => 'friendica.old',
297                                         'urlPath'   => 'is/old/path',
298                                         'sslPolicy' => BaseURL::DEFAULT_SSL_SCHEME,
299                                         'url'       => 'http://friendica.old/is/old/path',
300                                         'force_ssl' => true,
301                                 ],
302                                 'save' => [
303                                         'hostname'  => null,
304                                         'urlPath'   => 'new/path',
305                                         'sslPolicy' => null,
306                                 ],
307                                 'url' => 'http://friendica.old/new/path',
308                         ],
309                         'changeSSLPolicy' => [
310                                 'input' => [
311                                         'hostname'  => 'friendica.old',
312                                         'urlPath'   => 'is/old/path',
313                                         'sslPolicy' => BaseURL::DEFAULT_SSL_SCHEME,
314                                         'url'       => 'http://friendica.old/is/old/path',
315                                         'force_ssl' => true,
316                                 ],
317                                 'save' => [
318                                         'hostname'  => null,
319                                         'urlPath'   => null,
320                                         'sslPolicy' => BaseURL::SSL_POLICY_FULL,
321                                 ],
322                                 'url' => 'https://friendica.old/is/old/path',
323                         ],
324                 ];
325         }
326
327         /**
328          * Test the save() method
329          * @dataProvider dataSave
330          */
331         public function testSave($input, $save, $url)
332         {
333                 $configMock = \Mockery::mock(IManageConfigValues::class);
334                 $configMock->shouldReceive('get')->with('config', 'hostname')->andReturn($input['hostname']);
335                 $configMock->shouldReceive('get')->with('system', 'urlpath')->andReturn($input['urlPath']);
336                 $configMock->shouldReceive('get')->with('system', 'ssl_policy')->andReturn($input['sslPolicy']);
337                 $configMock->shouldReceive('get')->with('system', 'url')->andReturn($input['url']);
338                 $configMock->shouldReceive('get')->with('system', 'force_ssl')->andReturn($input['force_ssl']);
339
340                 $baseUrl = new BaseURL($configMock, []);
341
342                 if (isset($save['hostname']) && ($save['hostname'] !== $input['hostname'])) {
343                         $configMock->shouldReceive('set')->with('config', 'hostname', $save['hostname'])->andReturn(true)->once();
344                 }
345
346                 if (isset($save['urlPath']) && ($save['urlPath'] !== $input['urlPath'])) {
347                         $configMock->shouldReceive('set')->with('system', 'urlpath', $save['urlPath'])->andReturn(true)->once();
348                 }
349
350                 if (isset($save['sslPolicy']) && ($save['sslPolicy'] !== $input['sslPolicy'])) {
351                         $configMock->shouldReceive('set')->with('system', 'ssl_policy', $save['sslPolicy'])->andReturn(true)->once();
352                 }
353
354                 if ($input['url'] !== $url) {
355                         $configMock->shouldReceive('set')->with('system', 'url', $url)->andReturn(true)->once();
356                 }
357
358                 $baseUrl->save($save['hostname'], $save['sslPolicy'], $save['urlPath']);
359
360                 self::assertEquals($url, $baseUrl->get());
361         }
362
363         /**
364          * Test the saveByUrl() method
365          * @dataProvider dataSave
366          *
367          * @param $input
368          * @param $save
369          * @param $url
370          */
371         public function testSaveByUrl($input, $save, $url)
372         {
373                 $configMock = \Mockery::mock(IManageConfigValues::class);
374                 $configMock->shouldReceive('get')->with('config', 'hostname')->andReturn($input['hostname']);
375                 $configMock->shouldReceive('get')->with('system', 'urlpath')->andReturn($input['urlPath']);
376                 $configMock->shouldReceive('get')->with('system', 'ssl_policy')->andReturn($input['sslPolicy']);
377                 $configMock->shouldReceive('get')->with('system', 'url')->andReturn($input['url']);
378                 $configMock->shouldReceive('get')->with('system', 'force_ssl')->andReturn($input['force_ssl']);
379
380                 $baseUrl = new BaseURL($configMock, []);
381
382                 if (isset($save['hostname']) && ($save['hostname'] !== $input['hostname'])) {
383                         $configMock->shouldReceive('set')->with('config', 'hostname', $save['hostname'])->andReturn(true)->once();
384                 }
385
386                 if (isset($save['urlPath']) && ($save['urlPath'] !== $input['urlPath'])) {
387                         $configMock->shouldReceive('set')->with('system', 'urlpath', $save['urlPath'])->andReturn(true)->once();
388                 }
389
390                 if (isset($save['sslPolicy']) && ($save['sslPolicy'] !== $input['sslPolicy'])) {
391                         $configMock->shouldReceive('set')->with('system', 'ssl_policy', $save['sslPolicy'])->andReturn(true)->once();
392                 }
393
394                 if ($input['url'] !== $url) {
395                         $configMock->shouldReceive('set')->with('system', 'url', $url)->andReturn(true)->once();
396                 }
397
398                 $baseUrl->saveByURL($url);
399
400                 self::assertEquals($url, $baseUrl->get());
401         }
402
403         public function dataGetBaseUrl()
404         {
405                 return [
406                         'default'           => [
407                                 'sslPolicy' => BaseURL::DEFAULT_SSL_SCHEME,
408                                 'ssl'       => false,
409                                 'url'       => 'http://friendica.local/new/test',
410                                 'assert'    => 'http://friendica.local/new/test',
411                         ],
412                         'DefaultWithSSL'    => [
413                                 'sslPolicy' => BaseURL::DEFAULT_SSL_SCHEME,
414                                 'ssl'       => true,
415                                 'url'       => 'http://friendica.local/new/test',
416                                 'assert'    => 'https://friendica.local/new/test',
417                         ],
418                         'SSLFullWithSSL'    => [
419                                 'sslPolicy' => BaseURL::SSL_POLICY_FULL,
420                                 'ssl'       => true,
421                                 'url'       => 'http://friendica.local/new/test',
422                                 'assert'    => 'http://friendica.local/new/test',
423                         ],
424                         'SSLFullWithoutSSL' => [
425                                 'sslPolicy' => BaseURL::SSL_POLICY_FULL,
426                                 'ssl'       => false,
427                                 'url'       => 'https://friendica.local/new/test',
428                                 'assert'    => 'https://friendica.local/new/test',
429                         ],
430                         'NoSSLWithSSL'      => [
431                                 'sslPolicy' => BaseURL::SSL_POLICY_NONE,
432                                 'ssl'       => true,
433                                 'url'       => 'http://friendica.local/new/test',
434                                 'assert'    => 'http://friendica.local/new/test',
435                         ],
436                         'NoSSLWithoutSSL'   => [
437                                 'sslPolicy' => BaseURL::SSL_POLICY_NONE,
438                                 'ssl'       => false,
439                                 'url'       => 'http://friendica.local/new/test',
440                                 'assert'    => 'http://friendica.local/new/test',
441                         ],
442                 ];
443         }
444
445         /**
446          * Test the get() method
447          * @dataProvider dataGetBaseUrl
448          */
449         public function testGetURL($sslPolicy, $ssl, $url, $assert)
450         {
451                 $configMock = \Mockery::mock(IManageConfigValues::class);
452                 $configMock->shouldReceive('get')->with('config', 'hostname')->andReturn('friendica.local');
453                 $configMock->shouldReceive('get')->with('system', 'urlpath')->andReturn('new/test');
454                 $configMock->shouldReceive('get')->with('system', 'ssl_policy')->andReturn($sslPolicy);
455                 $configMock->shouldReceive('get')->with('system', 'url')->andReturn($url);
456
457                 $baseUrl = new BaseURL($configMock, []);
458
459                 self::assertEquals($assert, $baseUrl->get($ssl));
460         }
461
462         public function dataCheckRedirectHTTPS()
463         {
464                 return [
465                         'default' => [
466                                 'server' => [
467                                         'REQUEST_METHOD' => 'GET',
468                                         'HTTPS' => true,
469                                 ],
470                                 'forceSSL'  => false,
471                                 'sslPolicy' => BaseURL::DEFAULT_SSL_SCHEME,
472                                 'url'       => 'https://friendica.local',
473                                 'redirect'  => false,
474                         ],
475                         'forceSSL' => [
476                                 'server' => [
477                                         'REQUEST_METHOD' => 'GET',
478                                 ],
479                                 'forceSSL'  => true,
480                                 'sslPolicy' => BaseURL::DEFAULT_SSL_SCHEME,
481                                 'url'       => 'https://friendica.local',
482                                 'redirect'  => false,
483                         ],
484                         'forceSSLWithSSLPolicy' => [
485                                 'server' => [],
486                                 'forceSSL'  => true,
487                                 'sslPolicy' => BaseURL::SSL_POLICY_FULL,
488                                 'url'       => 'https://friendica.local',
489                                 'redirect'  => false,
490                         ],
491                         'forceSSLWithSSLPolicyAndGet' => [
492                                 'server' => [
493                                         'REQUEST_METHOD' => 'GET',
494                                 ],
495                                 'forceSSL'  => true,
496                                 'sslPolicy' => BaseURL::SSL_POLICY_FULL,
497                                 'url'       => 'https://friendica.local',
498                                 'redirect'  => true,
499                         ],
500                 ];
501         }
502
503         /**
504          * Test the checkRedirectHTTPS() method
505          * @dataProvider dataCheckRedirectHTTPS
506          */
507         public function testCheckRedirectHTTPS($server, $forceSSL, $sslPolicy, $url, $redirect)
508         {
509                 $configMock = \Mockery::mock(IManageConfigValues::class);
510                 $configMock->shouldReceive('get')->with('config', 'hostname')->andReturn('friendica.local');
511                 $configMock->shouldReceive('get')->with('system', 'urlpath')->andReturn('new/test');
512                 $configMock->shouldReceive('get')->with('system', 'ssl_policy')->andReturn($sslPolicy);
513                 $configMock->shouldReceive('get')->with('system', 'url')->andReturn($url);
514                 $configMock->shouldReceive('get')->with('system', 'force_ssl')->andReturn($forceSSL);
515
516                 $baseUrl = new BaseURL($configMock, $server);
517
518                 self::assertEquals($redirect, $baseUrl->checkRedirectHttps());
519         }
520
521         public function dataWrongSave()
522         {
523                 return [
524                         'wrongHostname' => [
525                                 'fail' => 'hostname',
526                         ],
527                         'wrongSSLPolicy' => [
528                                 'fail' => 'sslPolicy',
529                         ],
530                         'wrongURLPath' => [
531                                 'fail' => 'urlPath',
532                         ],
533                         'wrongURL' => [
534                                 'fail' => 'url',
535                         ],
536                 ];
537         }
538
539         /**
540          * Test the save() method with wrong parameters
541          * @dataProvider dataWrongSave
542          */
543         public function testWrongSave($fail)
544         {
545                 $configMock = \Mockery::mock(IManageConfigValues::class);
546                 $configMock->shouldReceive('get')->with('config', 'hostname')->andReturn('friendica.local');
547                 $configMock->shouldReceive('get')->with('system', 'urlpath')->andReturn('new/test');
548                 $configMock->shouldReceive('get')->with('system', 'ssl_policy')->andReturn(BaseURL::DEFAULT_SSL_SCHEME);
549                 $configMock->shouldReceive('get')->with('system', 'url')->andReturn('http://friendica.local/new/test');
550
551                 switch ($fail) {
552                         case 'hostname':
553                                 $configMock->shouldReceive('set')->with('config', 'hostname', \Mockery::any())->andReturn(false)->once();
554                                 break;
555                         case 'sslPolicy':
556                                 $configMock->shouldReceive('set')->with('config', 'hostname', \Mockery::any())->andReturn(true)->twice();
557                                 $configMock->shouldReceive('set')->with('system', 'ssl_policy', \Mockery::any())->andReturn(false)->once();
558                                 break;
559                         case 'urlPath':
560                                 $configMock->shouldReceive('set')->with('config', 'hostname', \Mockery::any())->andReturn(true)->twice();
561                                 $configMock->shouldReceive('set')->with('system', 'ssl_policy', \Mockery::any())->andReturn(true)->twice();
562                                 $configMock->shouldReceive('set')->with('system', 'urlpath', \Mockery::any())->andReturn(false)->once();
563                                 break;
564                         case 'url':
565                                 $configMock->shouldReceive('set')->with('config', 'hostname', \Mockery::any())->andReturn(true)->twice();
566                                 $configMock->shouldReceive('set')->with('system', 'ssl_policy', \Mockery::any())->andReturn(true)->twice();
567                                 $configMock->shouldReceive('set')->with('system', 'urlpath', \Mockery::any())->andReturn(true)->twice();
568                                 $configMock->shouldReceive('set')->with('system', 'url', \Mockery::any())->andReturn(false)->once();
569                                 break;
570                 }
571
572                 $baseUrl = new BaseURL($configMock, []);
573                 self::assertFalse($baseUrl->save('test', 10, 'nope'));
574
575                 // nothing should have changed because we never successfully saved anything
576                 self::assertEquals('friendica.local', $baseUrl->getHostname());
577                 self::assertEquals('new/test', $baseUrl->getUrlPath());
578                 self::assertEquals(BaseURL::DEFAULT_SSL_SCHEME, $baseUrl->getSSLPolicy());
579                 self::assertEquals('http://friendica.local/new/test', $baseUrl->get());
580         }
581 }