19 declare(strict_types=1);
21 require_once(
"vendor/composer/vendor/autoload.php");
28 private const URI_COMPLETE =
'g+it://github.com:8080/someaccount/somerepo/somerepo.git?query_par_1=val_1&query_par_2=val_2#fragment';
30 private const URI_COMPLETE_IPV4 =
'g+it://10.0.0.86:8080/someaccount/somerepo/somerepo.git/?query_par_1=val_1&query_par_2=val_2#fragment';
32 private const URI_COMPLETE_LOCALHOST =
'g+it://localhost:8080/someaccount/somerepo/somerepo.git/?query_par_1=val_1&query_par_2=val_2#fragment';
35 private const URI_NO_PATH_1 =
'g-it://ilias%2Da.de:8080?query_par_1=val_1&query_par_2=val_2#fragment';
36 private const URI_NO_PATH_2 =
'g.it://amaz;on.co.uk:8080/?query_par_1=val_1&query_par_2=val_2#fragment';
38 private const URI_NO_QUERY_1 =
'git://one-letter-top-level.a:8080/someaccount/somerepo/somerepo.git/#fragment';
39 private const URI_NO_QUERY_2 =
'git://github.com:8080/someaccount/somerepo/somerepo.git#fragment';
48 private const URI_PATH =
'git://git$,;hub.com:8080/someacc$,;ount/somerepo/somerepo.git/';
52 private const URI_NO_SCHEMA =
'git$,;hub.com:8080/someacc$,;ount/somerepo/somerepo.git/';
54 private const URI_NO_AUTHORITY =
'git://:8080/someaccount/somerepo/somerepo.git/?query_par_1=val_1&query_par_2=val_2#fragment';
62 private const URI_INVALID =
'https://host.de/ilias.php/"><script>alert(1)</script>?baseClass=ilObjChatroomGUI&cmd=getOSDNotifications&cmdMode=asynch&max_age=15192913';
64 private const URI_FAKEPCENC =
'g+it://github.com:8080/someaccoun%t/somerepo/somerepo.git/?query_par_1=val_1&query_par_2=val_2#fragment';
66 private const URI_REALPCTENC =
'g+it://github.com:8080/someaccount%2Fsomerepo/som%2brepo.git/?par_lower=val_%2b&par_upper=val_%C3%A1#fragment';
69 'par_lower' =>
'val_+',
70 'par_upper' =>
'val_รก' 79 private const URI_BASE =
'git://github.com:8080/someaccount/somerepo/somerepo.git';
86 #[\PHPUnit\Framework\Attributes\DoesNotPerformAssertions] 92 #[\PHPUnit\Framework\Attributes\Depends('test_init')] 96 $this->assertEquals(
'g+it', $uri->getSchema());
97 $this->assertEquals(
'10.0.0.86:8080', $uri->getAuthority());
98 $this->assertEquals(
'10.0.0.86', $uri->getHost());
99 $this->assertEquals(8080, $uri->getPort());
100 $this->assertEquals(
'someaccount/somerepo/somerepo.git', $uri->getPath());
101 $this->assertEquals(
'query_par_1=val_1&query_par_2=val_2', $uri->getQuery());
102 $this->assertEquals(
'fragment', $uri->getFragment());
105 #[\PHPUnit\Framework\Attributes\DataProvider('provideIPv6addresses')] 106 #[\PHPUnit\Framework\Attributes\Depends('test_init')] 110 $this->assertEquals(
'http', $uri->getSchema());
111 $this->assertEquals($host, $uri->getAuthority());
112 $this->assertEquals($host, $uri->getHost());
113 $this->assertEquals(
null, $uri->getPort());
114 $this->assertEquals(
null, $uri->getPath());
115 $this->assertEquals(
null, $uri->getQuery());
116 $this->assertEquals(
null, $uri->getFragment());
123 [
'[1234:5678:9ABC:DEF0:1234:5678:9ABC:DEF0]'],
124 [
'[1:2:3:4:5:6:7:8]'],
134 [
'[1234:5678:9ABC:DEF0:1234:5678:123.123.123.123]'],
136 [
'[::123.123.123.123]'],
137 [
'[1::123.123.123.123]'],
138 [
'[1:3:4::123.123.123.123]'],
139 [
'[::f:a:123.123.123.123]'],
143 #[\PHPUnit\Framework\Attributes\Depends('test_init')] 147 $this->assertEquals(
'g+it', $uri->getSchema());
148 $this->assertEquals(
'localhost:8080', $uri->getAuthority());
149 $this->assertEquals(
'localhost', $uri->getHost());
150 $this->assertEquals(8080, $uri->getPort());
151 $this->assertEquals(
'someaccount/somerepo/somerepo.git', $uri->getPath());
152 $this->assertEquals(
'query_par_1=val_1&query_par_2=val_2', $uri->getQuery());
153 $this->assertEquals(
'fragment', $uri->getFragment());
157 #[\PHPUnit\Framework\Attributes\Depends('test_init')] 160 $this->assertEquals(
'g+it', $uri->getSchema());
161 $this->assertEquals(
'github.com:8080', $uri->getAuthority());
162 $this->assertEquals(
'github.com', $uri->getHost());
163 $this->assertEquals(
'8080', $uri->getPort());
164 $this->assertEquals(
'someaccount/somerepo/somerepo.git', $uri->getPath());
165 $this->assertEquals(
'query_par_1=val_1&query_par_2=val_2', $uri->getQuery());
166 $this->assertEquals(
'fragment', $uri->getFragment());
169 #[\PHPUnit\Framework\Attributes\Depends('test_init')] 172 $this->assertEquals(
'g+it://github.com:8080/someaccount/somerepo/somerepo.git', $uri->getBaseURI());
175 #[\PHPUnit\Framework\Attributes\Depends('test_init')] 178 $base_uri = $uri->getBaseURI();
179 $this->assertEquals(
'g+it://github.com:8080/someaccount/somerepo/somerepo.git', $base_uri);
180 $this->assertEquals(
'g+it', $uri->getSchema());
181 $this->assertEquals(
'github.com:8080', $uri->getAuthority());
182 $this->assertEquals(
'github.com', $uri->getHost());
183 $this->assertEquals(
'8080', $uri->getPort());
184 $this->assertEquals(
'someaccount/somerepo/somerepo.git', $uri->getPath());
185 $this->assertEquals(
'query_par_1=val_1&query_par_2=val_2', $uri->getQuery());
186 $this->assertEquals(
'fragment', $uri->getFragment());
189 $this->assertEquals($base_uri, $uri->getBaseURI());
190 $this->assertEquals(
'g+it', $uri->getSchema());
191 $this->assertEquals(
'github.com:8080', $uri->getAuthority());
192 $this->assertEquals(
'github.com', $uri->getHost());
193 $this->assertEquals(
'8080', $uri->getPort());
194 $this->assertEquals(
'someaccount/somerepo/somerepo.git', $uri->getPath());
195 $this->assertNull($uri->getQuery());
196 $this->assertNull($uri->getFragment());
200 #[\PHPUnit\Framework\Attributes\Depends('test_init')] 204 $this->assertEquals(
'g-it', $uri->getSchema());
205 $this->assertEquals(
'ilias%2Da.de:8080', $uri->getAuthority());
206 $this->assertEquals(
'ilias%2Da.de', $uri->getHost());
207 $this->assertEquals(
'8080', $uri->getPort());
208 $this->assertNull($uri->getPath());
209 $this->assertEquals(
'query_par_1=val_1&query_par_2=val_2', $uri->getQuery());
210 $this->assertEquals(
'fragment', $uri->getFragment());
213 $this->assertEquals(
'g.it', $uri->getSchema());
214 $this->assertEquals(
'amaz;on.co.uk:8080', $uri->getAuthority());
215 $this->assertEquals(
'amaz;on.co.uk', $uri->getHost());
216 $this->assertEquals(
'8080', $uri->getPort());
217 $this->assertNull($uri->getPath());
218 $this->assertEquals(
'query_par_1=val_1&query_par_2=val_2', $uri->getQuery());
219 $this->assertEquals(
'fragment', $uri->getFragment());
222 #[\PHPUnit\Framework\Attributes\Depends('test_init')] 226 $this->assertEquals(
'git', $uri->getSchema());
227 $this->assertEquals(
'one-letter-top-level.a:8080', $uri->getAuthority());
228 $this->assertEquals(
'one-letter-top-level.a', $uri->getHost());
229 $this->assertEquals(
'8080', $uri->getPort());
230 $this->assertEquals(
'someaccount/somerepo/somerepo.git', $uri->getPath());
231 $this->assertNull($uri->getQuery());
232 $this->assertEquals(
'fragment', $uri->getFragment());
235 $this->assertEquals(
'git', $uri->getSchema());
236 $this->assertEquals(
'github.com:8080', $uri->getAuthority());
237 $this->assertEquals(
'github.com', $uri->getHost());
238 $this->assertEquals(
'8080', $uri->getPort());
239 $this->assertEquals(
'someaccount/somerepo/somerepo.git', $uri->getPath());
240 $this->assertNull($uri->getQuery());
241 $this->assertEquals(
'fragment', $uri->getFragment());
244 #[\PHPUnit\Framework\Attributes\Depends('test_init')] 248 $this->assertEquals(
'git', $uri->getSchema());
249 $this->assertEquals(
'github.com', $uri->getAuthority());
250 $this->assertEquals(
'github.com', $uri->getHost());
251 $this->assertNull($uri->getPort());
252 $this->assertNull($uri->getPath());
253 $this->assertEquals(
'query_p$,;:A!\'*+()ar_1=val_1&quer?y_par_2=val_2', $uri->getQuery());
254 $this->assertNull($uri->getFragment());
257 $this->assertEquals(
'git', $uri->getSchema());
258 $this->assertEquals(
'github.com', $uri->getAuthority());
259 $this->assertEquals(
'github.com', $uri->getHost());
260 $this->assertNull($uri->getPort());
261 $this->assertNull($uri->getPath());
262 $this->assertEquals(
'qu/ery_p$,;:A!\'*+()ar_1=val_1&quer?y_par_2=val_2', $uri->getQuery());
263 $this->assertNull($uri->getFragment());
266 #[\PHPUnit\Framework\Attributes\Depends('test_init')] 270 $this->assertEquals(
'git', $uri->getSchema());
271 $this->assertEquals(
'github.com:8080', $uri->getAuthority());
272 $this->assertEquals(
'github.com', $uri->getHost());
273 $this->assertEquals(
'8080', $uri->getPort());
274 $this->assertNull($uri->getPath());
275 $this->assertNull($uri->getQuery());
276 $this->assertEquals(
'fragment$,;:A!\'*+()ar_1=val_1&', $uri->getFragment());
279 #[\PHPUnit\Framework\Attributes\Depends('test_init')] 283 $this->assertEquals(
'git', $uri->getSchema());
284 $this->assertEquals(
'git$,;hub.com:8080', $uri->getAuthority());
285 $this->assertEquals(
'git$,;hub.com', $uri->getHost());
286 $this->assertEquals(
'8080', $uri->getPort());
287 $this->assertEquals(
'someacc$,;ount/somerepo/somerepo.git', $uri->getPath());
288 $this->assertNull($uri->getQuery());
289 $this->assertEquals(
'frag:A!\'*+()arment', $uri->getFragment());
292 #[\PHPUnit\Framework\Attributes\Depends('test_init')] 296 $this->assertEquals(
'git', $uri->getSchema());
297 $this->assertEquals(
'git$,;hub.com:8080', $uri->getAuthority());
298 $this->assertEquals(
'git$,;hub.com', $uri->getHost());
299 $this->assertEquals(
'8080', $uri->getPort());
300 $this->assertEquals(
'someacc$,;ount/somerepo/somerepo.git', $uri->getPath());
301 $this->assertNull($uri->getQuery());
302 $this->assertNull($uri->getFragment());
303 $this->assertEquals(
'git://git$,;hub.com:8080/someacc$,;ount/somerepo/somerepo.git', $uri->getBaseURI());
306 #[\PHPUnit\Framework\Attributes\Depends('test_init')] 310 $this->assertEquals(
'git', $uri->getSchema());
311 $this->assertEquals(
'git$,;hub.com', $uri->getAuthority());
312 $this->assertEquals(
'git$,;hub.com', $uri->getHost());
313 $this->assertNull($uri->getPort());
314 $this->assertNull($uri->getPath());
315 $this->assertNull($uri->getQuery());
316 $this->assertNull($uri->getFragment());
317 $this->assertEquals(
'git://git$,;hub.com', $uri->getBaseURI());
320 #[\PHPUnit\Framework\Attributes\Depends('test_init')] 323 $this->expectException(TypeError::class);
327 #[\PHPUnit\Framework\Attributes\Depends('test_init')] 330 $this->expectException(TypeError::class);
334 #[\PHPUnit\Framework\Attributes\Depends('test_init')] 337 $this->expectException(TypeError::class);
341 #[\PHPUnit\Framework\Attributes\Depends('test_init')] 344 $this->expectException(InvalidArgumentException::class);
348 #[\PHPUnit\Framework\Attributes\Depends('test_init')] 351 $this->expectException(InvalidArgumentException::class);
355 #[\PHPUnit\Framework\Attributes\Depends('test_init')] 358 $this->expectException(InvalidArgumentException::class);
362 #[\PHPUnit\Framework\Attributes\Depends('test_init')] 366 $this->assertEquals(self::PATH_REALPCTENC, $uri->getPath());
367 $this->assertEquals(self::PARAMS_REALPCTENC, $uri->getParameters());
370 #[\PHPUnit\Framework\Attributes\Depends('test_init')] 373 $this->expectException(InvalidArgumentException::class);
377 #[\PHPUnit\Framework\Attributes\Depends('test_init')] 380 $this->expectException(InvalidArgumentException::class);
384 #[\PHPUnit\Framework\Attributes\Depends('test_init')] 387 $this->expectException(InvalidArgumentException::class);
391 #[\PHPUnit\Framework\Attributes\Depends('test_init')] 394 $this->expectException(InvalidArgumentException::class);
398 #[\PHPUnit\Framework\Attributes\Depends('test_init')] 401 $this->expectException(InvalidArgumentException::class);
405 #[\PHPUnit\Framework\Attributes\Depends('test_init')] 408 $this->expectException(InvalidArgumentException::class);
412 #[\PHPUnit\Framework\Attributes\Depends('test_init')] 415 $this->assertEquals(
'g+it', $uri->getSchema());
416 $this->assertEquals(
'github.com:8080', $uri->getAuthority());
417 $this->assertEquals(
'github.com', $uri->getHost());
418 $this->assertEquals(
'8080', $uri->getPort());
419 $this->assertEquals(
'someaccount/somerepo/somerepo.git', $uri->getPath());
420 $this->assertEquals(
'query_par_1=val_1&query_par_2=val_2', $uri->getQuery());
421 $this->assertEquals(
'fragment', $uri->getFragment());
422 $uri = $uri->withSchema(
'http');
423 $this->assertEquals(
'http', $uri->getSchema());
424 $this->assertEquals(
'github.com:8080', $uri->getAuthority());
425 $this->assertEquals(
'github.com', $uri->getHost());
426 $this->assertEquals(
'8080', $uri->getPort());
427 $this->assertEquals(
'someaccount/somerepo/somerepo.git', $uri->getPath());
428 $this->assertEquals(
'query_par_1=val_1&query_par_2=val_2', $uri->getQuery());
429 $this->assertEquals(
'fragment', $uri->getFragment());
432 #[\PHPUnit\Framework\Attributes\Depends('test_with_schema')] 435 $this->expectException(InvalidArgumentException::class);
437 $uri->withSchema(
'');
440 #[\PHPUnit\Framework\Attributes\Depends('test_with_schema')] 443 $this->expectException(InvalidArgumentException::class);
445 $uri->withSchema(
'1aa');
448 #[\PHPUnit\Framework\Attributes\Depends('test_init')] 451 $this->assertEquals(
'g+it', $uri->getSchema());
452 $this->assertEquals(
'github.com:8080', $uri->getAuthority());
453 $this->assertEquals(
'github.com', $uri->getHost());
454 $this->assertEquals(
'8080', $uri->getPort());
455 $this->assertEquals(
'someaccount/somerepo/somerepo.git', $uri->getPath());
456 $this->assertEquals(
'query_par_1=val_1&query_par_2=val_2', $uri->getQuery());
457 $this->assertEquals(
'fragment', $uri->getFragment());
458 $uri = $uri->withPort(80);
459 $this->assertEquals(
'g+it', $uri->getSchema());
460 $this->assertEquals(
'github.com:80', $uri->getAuthority());
461 $this->assertEquals(
'github.com', $uri->getHost());
462 $this->assertEquals(
'80', $uri->getPort());
463 $this->assertEquals(
'someaccount/somerepo/somerepo.git', $uri->getPath());
464 $this->assertEquals(
'query_par_1=val_1&query_par_2=val_2', $uri->getQuery());
465 $this->assertEquals(
'fragment', $uri->getFragment());
466 $uri = $uri->withPort();
467 $this->assertEquals(
'g+it', $uri->getSchema());
468 $this->assertEquals(
'github.com', $uri->getAuthority());
469 $this->assertEquals(
'github.com', $uri->getHost());
470 $this->assertNull($uri->getPort());
471 $this->assertEquals(
'someaccount/somerepo/somerepo.git', $uri->getPath());
472 $this->assertEquals(
'query_par_1=val_1&query_par_2=val_2', $uri->getQuery());
473 $this->assertEquals(
'fragment', $uri->getFragment());
477 #[\PHPUnit\Framework\Attributes\Depends('test_with_port')] 480 $this->expectException(TypeError::class);
482 $uri->withPort(
'a111');
485 #[\PHPUnit\Framework\Attributes\Depends('test_with_port')] 488 $this->expectException(TypeError::class);
490 $uri->withPort(
'foo');
493 #[\PHPUnit\Framework\Attributes\Depends('test_init')] 496 $this->assertEquals(
'g+it', $uri->getSchema());
497 $this->assertEquals(
'github.com:8080', $uri->getAuthority());
498 $this->assertEquals(
'github.com', $uri->getHost());
499 $this->assertEquals(
'8080', $uri->getPort());
500 $this->assertEquals(
'someaccount/somerepo/somerepo.git', $uri->getPath());
501 $this->assertEquals(
'query_par_1=val_1&query_par_2=val_2', $uri->getQuery());
502 $this->assertEquals(
'fragment', $uri->getFragment());
503 $uri = $uri->withHost(
'ilias.de');
504 $this->assertEquals(
'g+it', $uri->getSchema());
505 $this->assertEquals(
'ilias.de:8080', $uri->getAuthority());
506 $this->assertEquals(
'ilias.de', $uri->getHost());
507 $this->assertEquals(
'8080', $uri->getPort());
508 $this->assertEquals(
'someaccount/somerepo/somerepo.git', $uri->getPath());
509 $this->assertEquals(
'query_par_1=val_1&query_par_2=val_2', $uri->getQuery());
510 $this->assertEquals(
'fragment', $uri->getFragment());
513 #[\PHPUnit\Framework\Attributes\Depends('test_with_host')] 516 $this->expectException(InvalidArgumentException::class);
518 $uri->withHost(
'-foo-.de');
523 $this->expectException(InvalidArgumentException::class);
528 #[\PHPUnit\Framework\Attributes\Depends('test_with_host')] 531 $this->expectException(InvalidArgumentException::class);
533 $uri->withHost(
'ilias.de"><script');
536 #[\PHPUnit\Framework\Attributes\Depends('test_init')] 539 $this->assertEquals(
'g+it', $uri->getSchema());
540 $this->assertEquals(
'github.com:8080', $uri->getAuthority());
541 $this->assertEquals(
'github.com', $uri->getHost());
542 $this->assertEquals(
'8080', $uri->getPort());
543 $this->assertEquals(
'someaccount/somerepo/somerepo.git', $uri->getPath());
544 $this->assertEquals(
'query_par_1=val_1&query_par_2=val_2', $uri->getQuery());
545 $this->assertEquals(
'fragment', $uri->getFragment());
546 $uri = $uri->withAuthority(
'www1.ilias.de');
547 $this->assertEquals(
'g+it', $uri->getSchema());
548 $this->assertEquals(
'www1.ilias.de', $uri->getAuthority());
549 $this->assertEquals(
'www1.ilias.de', $uri->getHost());
550 $this->assertNull($uri->getPort());
551 $this->assertEquals(
'someaccount/somerepo/somerepo.git', $uri->getPath());
552 $this->assertEquals(
'query_par_1=val_1&query_par_2=val_2', $uri->getQuery());
553 $this->assertEquals(
'fragment', $uri->getFragment());
554 $uri = $uri->withAuthority(
'ilias.de:80');
555 $this->assertEquals(
'g+it', $uri->getSchema());
556 $this->assertEquals(
'ilias.de:80', $uri->getAuthority());
557 $this->assertEquals(
'ilias.de', $uri->getHost());
558 $this->assertEquals(
'80', $uri->getPort());
559 $this->assertEquals(
'someaccount/somerepo/somerepo.git', $uri->getPath());
560 $this->assertEquals(
'query_par_1=val_1&query_par_2=val_2', $uri->getQuery());
561 $this->assertEquals(
'fragment', $uri->getFragment());
562 $uri = $uri->withAuthority(
'a:1');
563 $this->assertEquals(
'g+it', $uri->getSchema());
564 $this->assertEquals(
'a:1', $uri->getAuthority());
565 $this->assertEquals(
'a', $uri->getHost());
566 $this->assertEquals(1, $uri->getPort());
567 $this->assertEquals(
'someaccount/somerepo/somerepo.git', $uri->getPath());
568 $this->assertEquals(
'query_par_1=val_1&query_par_2=val_2', $uri->getQuery());
569 $this->assertEquals(
'fragment', $uri->getFragment());
570 $uri = $uri->withAuthority(
'a');
571 $this->assertEquals(
'g+it', $uri->getSchema());
572 $this->assertEquals(
'a', $uri->getAuthority());
573 $this->assertEquals(
'a', $uri->getHost());
574 $this->assertNull($uri->getPort());
575 $this->assertEquals(
'someaccount/somerepo/somerepo.git', $uri->getPath());
576 $this->assertEquals(
'query_par_1=val_1&query_par_2=val_2', $uri->getQuery());
577 $this->assertEquals(
'fragment', $uri->getFragment());
578 $uri = $uri->withAuthority(
'1.2.3.4');
579 $this->assertEquals(
'g+it', $uri->getSchema());
580 $this->assertEquals(
'1.2.3.4', $uri->getAuthority());
581 $this->assertEquals(
'1.2.3.4', $uri->getHost());
582 $this->assertNull($uri->getPort());
583 $this->assertEquals(
'someaccount/somerepo/somerepo.git', $uri->getPath());
584 $this->assertEquals(
'query_par_1=val_1&query_par_2=val_2', $uri->getQuery());
585 $this->assertEquals(
'fragment', $uri->getFragment());
586 $uri = $uri->withAuthority(
'1.2.3.4:5');
587 $this->assertEquals(
'g+it', $uri->getSchema());
588 $this->assertEquals(
'1.2.3.4:5', $uri->getAuthority());
589 $this->assertEquals(
'1.2.3.4', $uri->getHost());
590 $this->assertEquals(5, $uri->getPort());
591 $this->assertEquals(
'someaccount/somerepo/somerepo.git', $uri->getPath());
592 $this->assertEquals(
'query_par_1=val_1&query_par_2=val_2', $uri->getQuery());
593 $this->assertEquals(
'fragment', $uri->getFragment());
594 $uri = $uri->withAuthority(
'localhost1');
595 $this->assertEquals(
'g+it', $uri->getSchema());
596 $this->assertEquals(
'localhost1', $uri->getAuthority());
597 $this->assertEquals(
'localhost1', $uri->getHost());
598 $this->assertNull($uri->getPort());
599 $this->assertEquals(
'someaccount/somerepo/somerepo.git', $uri->getPath());
600 $this->assertEquals(
'query_par_1=val_1&query_par_2=val_2', $uri->getQuery());
601 $this->assertEquals(
'fragment', $uri->getFragment());
602 $uri = $uri->withAuthority(
'localhost1:10');
603 $this->assertEquals(
'g+it', $uri->getSchema());
604 $this->assertEquals(
'localhost1:10', $uri->getAuthority());
605 $this->assertEquals(
'localhost1', $uri->getHost());
606 $this->assertEquals(10, $uri->getPort());
607 $this->assertEquals(
'someaccount/somerepo/somerepo.git', $uri->getPath());
608 $this->assertEquals(
'query_par_1=val_1&query_par_2=val_2', $uri->getQuery());
609 $this->assertEquals(
'fragment', $uri->getFragment());
612 #[\PHPUnit\Framework\Attributes\Depends('test_with_authority')] 615 $this->expectException(InvalidArgumentException::class);
617 $uri->withAuthority(
'-foo-.de');
620 #[\PHPUnit\Framework\Attributes\Depends('test_with_authority')] 623 $this->expectException(InvalidArgumentException::class);
625 $uri->withAuthority(
'-bar-.de:6060');
629 #[\PHPUnit\Framework\Attributes\Depends('test_with_authority')] 632 $this->expectException(InvalidArgumentException::class);
634 $uri->withHost(
'ilias.de:');
637 #[\PHPUnit\Framework\Attributes\Depends('test_with_authority')] 640 $this->expectException(InvalidArgumentException::class);
642 $uri->withHost(
'ilias.de: ');
645 #[\PHPUnit\Framework\Attributes\Depends('test_with_authority')] 648 $this->expectException(InvalidArgumentException::class);
650 $uri->withHost(
'ilias.de:aaa');
653 #[\PHPUnit\Framework\Attributes\Depends('test_with_authority')] 656 $this->expectException(InvalidArgumentException::class);
658 $uri->withAuthority(
'foo.de&<script>');
662 #[\PHPUnit\Framework\Attributes\Depends('test_with_authority')] 665 $this->expectException(InvalidArgumentException::class);
667 $uri->withAuthority(
'foo.de"><script>alert');
671 #[\PHPUnit\Framework\Attributes\Depends('test_with_authority')] 674 $this->expectException(InvalidArgumentException::class);
676 $uri->withAuthority(
' :80');
679 #[\PHPUnit\Framework\Attributes\Depends('test_init')] 682 $this->assertEquals(
'g+it', $uri->getSchema());
683 $this->assertEquals(
'github.com:8080', $uri->getAuthority());
684 $this->assertEquals(
'github.com', $uri->getHost());
685 $this->assertEquals(
'8080', $uri->getPort());
686 $this->assertEquals(
'someaccount/somerepo/somerepo.git', $uri->getPath());
687 $this->assertEquals(
'query_par_1=val_1&query_par_2=val_2', $uri->getQuery());
688 $this->assertEquals(
'fragment', $uri->getFragment());
689 $uri = $uri->withPath(
'a/b');
690 $this->assertEquals(
'g+it', $uri->getSchema());
691 $this->assertEquals(
'github.com:8080', $uri->getAuthority());
692 $this->assertEquals(
'github.com', $uri->getHost());
693 $this->assertEquals(
'8080', $uri->getPort());
694 $this->assertEquals(
'a/b', $uri->getPath());
695 $this->assertEquals(
'query_par_1=val_1&query_par_2=val_2', $uri->getQuery());
696 $this->assertEquals(
'fragment', $uri->getFragment());
697 $uri = $uri->withPath();
698 $this->assertEquals(
'g+it', $uri->getSchema());
699 $this->assertEquals(
'github.com:8080', $uri->getAuthority());
700 $this->assertEquals(
'github.com', $uri->getHost());
701 $this->assertEquals(
'8080', $uri->getPort());
702 $this->assertNull($uri->getPath());
703 $this->assertEquals(
'query_par_1=val_1&query_par_2=val_2', $uri->getQuery());
704 $this->assertEquals(
'fragment', $uri->getFragment());
707 #[\PHPUnit\Framework\Attributes\Depends('test_with_path')] 710 $this->expectException(InvalidArgumentException::class);
712 $uri->withPath(
'/<script>/a');
715 #[\PHPUnit\Framework\Attributes\Depends('test_with_path')] 718 $this->expectException(InvalidArgumentException::class);
720 $uri->withPath(
'//a/b');
723 #[\PHPUnit\Framework\Attributes\Depends('test_with_path')] 726 $this->expectException(InvalidArgumentException::class);
728 $uri->withPath(
':a/b');
731 #[\PHPUnit\Framework\Attributes\Depends('test_init')] 734 $this->assertEquals(
'g+it', $uri->getSchema());
735 $this->assertEquals(
'github.com:8080', $uri->getAuthority());
736 $this->assertEquals(
'github.com', $uri->getHost());
737 $this->assertEquals(
'8080', $uri->getPort());
738 $this->assertEquals(
'someaccount/somerepo/somerepo.git', $uri->getPath());
739 $this->assertEquals(
'query_par_1=val_1&query_par_2=val_2', $uri->getQuery());
740 $this->assertEquals(
'fragment', $uri->getFragment());
741 $uri = $uri->withQuery(
'query_par_a1=val_a1');
742 $this->assertEquals(
'g+it', $uri->getSchema());
743 $this->assertEquals(
'github.com:8080', $uri->getAuthority());
744 $this->assertEquals(
'github.com', $uri->getHost());
745 $this->assertEquals(
'8080', $uri->getPort());
746 $this->assertEquals(
'someaccount/somerepo/somerepo.git', $uri->getPath());
747 $this->assertEquals(
'query_par_a1=val_a1', $uri->getQuery());
748 $this->assertEquals(
'fragment', $uri->getFragment());
749 $uri = $uri->withQuery();
750 $this->assertEquals(
'g+it', $uri->getSchema());
751 $this->assertEquals(
'github.com:8080', $uri->getAuthority());
752 $this->assertEquals(
'github.com', $uri->getHost());
753 $this->assertEquals(
'8080', $uri->getPort());
754 $this->assertEquals(
'someaccount/somerepo/somerepo.git', $uri->getPath());
755 $this->assertNull($uri->getQuery());
756 $this->assertEquals(
'fragment', $uri->getFragment());
759 #[\PHPUnit\Framework\Attributes\Depends('test_with_query')] 762 $this->expectException(InvalidArgumentException::class);
764 $uri->withQuery(
'<script>a');
767 #[\PHPUnit\Framework\Attributes\Depends('test_with_query')] 770 $this->expectException(InvalidArgumentException::class);
772 $uri->withQuery(
'aa[]');
775 #[\PHPUnit\Framework\Attributes\Depends('test_init')] 778 $this->assertEquals(
'g+it', $uri->getSchema());
779 $this->assertEquals(
'github.com:8080', $uri->getAuthority());
780 $this->assertEquals(
'github.com', $uri->getHost());
781 $this->assertEquals(
'8080', $uri->getPort());
782 $this->assertEquals(
'someaccount/somerepo/somerepo.git', $uri->getPath());
783 $this->assertEquals(
'query_par_1=val_1&query_par_2=val_2', $uri->getQuery());
784 $this->assertEquals(
'fragment', $uri->getFragment());
785 $uri = $uri->withFragment(
'someFragment');
786 $this->assertEquals(
'g+it', $uri->getSchema());
787 $this->assertEquals(
'github.com:8080', $uri->getAuthority());
788 $this->assertEquals(
'github.com', $uri->getHost());
789 $this->assertEquals(
'8080', $uri->getPort());
790 $this->assertEquals(
'someaccount/somerepo/somerepo.git', $uri->getPath());
791 $this->assertEquals(
'query_par_1=val_1&query_par_2=val_2', $uri->getQuery());
792 $this->assertEquals(
'someFragment', $uri->getFragment());
793 $uri = $uri->withFragment();
794 $this->assertEquals(
'g+it', $uri->getSchema());
795 $this->assertEquals(
'github.com:8080', $uri->getAuthority());
796 $this->assertEquals(
'github.com', $uri->getHost());
797 $this->assertEquals(
'8080', $uri->getPort());
798 $this->assertEquals(
'someaccount/somerepo/somerepo.git', $uri->getPath());
799 $this->assertEquals(
'query_par_1=val_1&query_par_2=val_2', $uri->getQuery());
800 $this->assertNull($uri->getFragment());
803 #[\PHPUnit\Framework\Attributes\Depends('test_with_fragment')] 806 $this->expectException(InvalidArgumentException::class);
808 $uri->withFragment(
'aaa[]');
811 #[\PHPUnit\Framework\Attributes\Depends('test_with_fragment')] 814 $this->expectException(InvalidArgumentException::class);
816 $uri->withFragment(
'script>');
830 $url = self::URI_BASE .
'?' . http_build_query(self::PARAMS);
834 $uri->getParameters()
839 #[\PHPUnit\Framework\Attributes\Depends('testGetParameters')] 842 $k = array_keys(self::PARAMS)[0];
845 $uri->getParameter($k)
849 #[\PHPUnit\Framework\Attributes\Depends('testGetParameters')] 852 $params = [
'x' => 1,
'y' => 2];
853 $uri = $uri->withParameters(
$params);
856 $uri->getParameters()
861 #[\PHPUnit\Framework\Attributes\Depends('testWithParameters')] 864 $uri = $uri->withParameter(
'x', 5);
867 $uri->getParameter(
'x')
871 #[\PHPUnit\Framework\Attributes\Depends('testWithParameters')] 878 $uri = $uri->withParameter(
'z', 5);
881 $uri->getParameters()
885 #[\PHPUnit\Framework\Attributes\Depends('testGetParameters')] 888 $params = [
'x' => 1,
'y' => [10, 11, 12]];
889 $uri = $uri->withParameters(
$params);
892 $uri->getParameters()
895 'git://github.com:8080/someaccount/somerepo/somerepo.git?x=1&y%5B0%5D=10&y%5B1%5D=11&y%5B2%5D=12',
900 $uri->getParameter(
'y')
909 $uri->getParameters()
912 $this->assertNull($uri->getParameter(
'y'));
915 self::URI_NO_QUERY_2,
test_with_authority_invalid_3()
testWithArrayParameters(ILIAS\Data\URI $uri)
const URI_HOST_ALPHADIG_START_2
test_with_path_invalid_3()
test_alphadigit_start_host_5()
const URI_COMPLETE_LOCALHOST
test_base_uri_idempotent($uri)
const URI_HOST_ALPHADIG_START_3
const const URI_HOST_ALPHADIG_START_1
test_with_authority_invalid_7()
test_with_authority_invalid_6()
test_wrong_authority_in_schema_1()
test_with_authority_invalid_4()
test_with_path_invalid_2()
test_with_authority_invalid_2()
test_with_host_invalid_4()
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
test_alphadigit_start_host_4()
const URI_AUTHORITY_AND_FRAGMENT
Interface Observer Contains several chained tasks and infos about them.
const URI_HOST_ALPHADIG_START_5
test_with_authority_invalid_1()
testAppendParameter(ILIAS\Data\URI $uri)
static provideIPv6addresses()
testGetParameter(ILIAS\Data\URI $uri)
test_with_host_invalid_1()
test_wrong_char_in_schema()
test_with_query_invalid_1()
const URI_WRONG_AUTHORITY_1
test_with_fragment_invalid_1()
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
test_with_query_invalid_2()
test_with_fragment_invalid_2()
testWithParameters(ILIAS\Data\URI $uri)
const URI_HOST_ALPHADIG_START_4
test_with_port_invalid_1()
test_with_host_invalid_3()
test_with_authority_invalid_8()
test_authority_path_fragment()
test_authority_and_query()
const URI_AUTHORITY_AND_QUERY_2
testSubstituteParameter(ILIAS\Data\URI $uri)
test_with_authority($uri)
test_alphadigit_start_host_3()
test_alphadigit_start_host_2()
test_with_authority_invalid_5()
test_with_schema_invalid_1()
test_with_port_invalid_2()
test_authority_and_fragment()
const URI_AUTHORITY_PATH_FRAGMENT
test_wrong_authority_in_schema_2()
const URI_AUTHORITY_AND_QUERY_1
test_alphadigit_start_host()
test_with_path_invalid_1()
test_with_schema_invalid_2()
const URI_WRONG_AUTHORITY_2