19declare(strict_types=1);
21require_once(
"vendor/composer/vendor/autoload.php");
24use PHPUnit\Framework\TestCase;
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';
61 private const URI_INVALID =
'https://host.de/ilias.php/"><script>alert(1)</script>?baseClass=ilObjChatroomGUI&cmd=getOSDNotifications&cmdMode=asynch&max_age=15192913';
65 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';
67 private const URI_REALPCTENC =
'g+it://github.com:8080/someaccount%2Fsomerepo/som%2brepo.git/?par_lower=val_%2b&par_upper=val_%C3%A1#fragment';
70 'par_lower' =>
'val_+',
71 'par_upper' =>
'val_รก'
80 private const URI_BASE =
'git://github.com:8080/someaccount/somerepo/somerepo.git';
87 #[\PHPUnit\Framework\Attributes\DoesNotPerformAssertions]
93 #[\PHPUnit\Framework\Attributes\Depends('test_init')]
97 $this->assertEquals(
'g+it', $uri->getSchema());
98 $this->assertEquals(
'10.0.0.86:8080', $uri->getAuthority());
99 $this->assertEquals(
'10.0.0.86', $uri->getHost());
100 $this->assertEquals(8080, $uri->getPort());
101 $this->assertEquals(
'someaccount/somerepo/somerepo.git', $uri->getPath());
102 $this->assertEquals(
'query_par_1=val_1&query_par_2=val_2', $uri->getQuery());
103 $this->assertEquals(
'fragment', $uri->getFragment());
106 #[\PHPUnit\Framework\Attributes\DataProvider('provideIPv6addresses')]
107 #[\PHPUnit\Framework\Attributes\Depends('test_init')]
111 $this->assertEquals(
'http', $uri->getSchema());
112 $this->assertEquals($host, $uri->getAuthority());
113 $this->assertEquals($host, $uri->getHost());
114 $this->assertEquals(
null, $uri->getPort());
115 $this->assertEquals(
null, $uri->getPath());
116 $this->assertEquals(
null, $uri->getQuery());
117 $this->assertEquals(
null, $uri->getFragment());
124 [
'[1234:5678:9ABC:DEF0:1234:5678:9ABC:DEF0]'],
125 [
'[1:2:3:4:5:6:7:8]'],
135 [
'[1234:5678:9ABC:DEF0:1234:5678:123.123.123.123]'],
137 [
'[::123.123.123.123]'],
138 [
'[1::123.123.123.123]'],
139 [
'[1:3:4::123.123.123.123]'],
140 [
'[::f:a:123.123.123.123]'],
144 #[\PHPUnit\Framework\Attributes\Depends('test_init')]
148 $this->assertEquals(
'g+it', $uri->getSchema());
149 $this->assertEquals(
'localhost:8080', $uri->getAuthority());
150 $this->assertEquals(
'localhost', $uri->getHost());
151 $this->assertEquals(8080, $uri->getPort());
152 $this->assertEquals(
'someaccount/somerepo/somerepo.git', $uri->getPath());
153 $this->assertEquals(
'query_par_1=val_1&query_par_2=val_2', $uri->getQuery());
154 $this->assertEquals(
'fragment', $uri->getFragment());
158 #[\PHPUnit\Framework\Attributes\Depends('test_init')]
161 $this->assertEquals(
'g+it', $uri->getSchema());
162 $this->assertEquals(
'github.com:8080', $uri->getAuthority());
163 $this->assertEquals(
'github.com', $uri->getHost());
164 $this->assertEquals(
'8080', $uri->getPort());
165 $this->assertEquals(
'someaccount/somerepo/somerepo.git', $uri->getPath());
166 $this->assertEquals(
'query_par_1=val_1&query_par_2=val_2', $uri->getQuery());
167 $this->assertEquals(
'fragment', $uri->getFragment());
170 #[\PHPUnit\Framework\Attributes\Depends('test_init')]
173 $this->assertEquals(
'g+it://github.com:8080/someaccount/somerepo/somerepo.git', $uri->getBaseURI());
176 #[\PHPUnit\Framework\Attributes\Depends('test_init')]
179 $base_uri = $uri->getBaseURI();
180 $this->assertEquals(
'g+it://github.com:8080/someaccount/somerepo/somerepo.git', $base_uri);
181 $this->assertEquals(
'g+it', $uri->getSchema());
182 $this->assertEquals(
'github.com:8080', $uri->getAuthority());
183 $this->assertEquals(
'github.com', $uri->getHost());
184 $this->assertEquals(
'8080', $uri->getPort());
185 $this->assertEquals(
'someaccount/somerepo/somerepo.git', $uri->getPath());
186 $this->assertEquals(
'query_par_1=val_1&query_par_2=val_2', $uri->getQuery());
187 $this->assertEquals(
'fragment', $uri->getFragment());
190 $this->assertEquals($base_uri, $uri->getBaseURI());
191 $this->assertEquals(
'g+it', $uri->getSchema());
192 $this->assertEquals(
'github.com:8080', $uri->getAuthority());
193 $this->assertEquals(
'github.com', $uri->getHost());
194 $this->assertEquals(
'8080', $uri->getPort());
195 $this->assertEquals(
'someaccount/somerepo/somerepo.git', $uri->getPath());
196 $this->assertNull($uri->getQuery());
197 $this->assertNull($uri->getFragment());
201 #[\PHPUnit\Framework\Attributes\Depends('test_init')]
205 $this->assertEquals(
'g-it', $uri->getSchema());
206 $this->assertEquals(
'ilias%2Da.de:8080', $uri->getAuthority());
207 $this->assertEquals(
'ilias%2Da.de', $uri->getHost());
208 $this->assertEquals(
'8080', $uri->getPort());
209 $this->assertNull($uri->getPath());
210 $this->assertEquals(
'query_par_1=val_1&query_par_2=val_2', $uri->getQuery());
211 $this->assertEquals(
'fragment', $uri->getFragment());
214 $this->assertEquals(
'g.it', $uri->getSchema());
215 $this->assertEquals(
'amaz;on.co.uk:8080', $uri->getAuthority());
216 $this->assertEquals(
'amaz;on.co.uk', $uri->getHost());
217 $this->assertEquals(
'8080', $uri->getPort());
218 $this->assertNull($uri->getPath());
219 $this->assertEquals(
'query_par_1=val_1&query_par_2=val_2', $uri->getQuery());
220 $this->assertEquals(
'fragment', $uri->getFragment());
223 #[\PHPUnit\Framework\Attributes\Depends('test_init')]
227 $this->assertEquals(
'git', $uri->getSchema());
228 $this->assertEquals(
'one-letter-top-level.a:8080', $uri->getAuthority());
229 $this->assertEquals(
'one-letter-top-level.a', $uri->getHost());
230 $this->assertEquals(
'8080', $uri->getPort());
231 $this->assertEquals(
'someaccount/somerepo/somerepo.git', $uri->getPath());
232 $this->assertNull($uri->getQuery());
233 $this->assertEquals(
'fragment', $uri->getFragment());
236 $this->assertEquals(
'git', $uri->getSchema());
237 $this->assertEquals(
'github.com:8080', $uri->getAuthority());
238 $this->assertEquals(
'github.com', $uri->getHost());
239 $this->assertEquals(
'8080', $uri->getPort());
240 $this->assertEquals(
'someaccount/somerepo/somerepo.git', $uri->getPath());
241 $this->assertNull($uri->getQuery());
242 $this->assertEquals(
'fragment', $uri->getFragment());
245 #[\PHPUnit\Framework\Attributes\Depends('test_init')]
249 $this->assertEquals(
'git', $uri->getSchema());
250 $this->assertEquals(
'github.com', $uri->getAuthority());
251 $this->assertEquals(
'github.com', $uri->getHost());
252 $this->assertNull($uri->getPort());
253 $this->assertNull($uri->getPath());
254 $this->assertEquals(
'query_p$,;A!\'*+()ar_1=val_1&quer?y_par_2=val_2', $uri->getQuery());
255 $this->assertNull($uri->getFragment());
258 $this->assertEquals(
'git', $uri->getSchema());
259 $this->assertEquals(
'github.com', $uri->getAuthority());
260 $this->assertEquals(
'github.com', $uri->getHost());
261 $this->assertNull($uri->getPort());
262 $this->assertNull($uri->getPath());
263 $this->assertEquals(
'qu/ery_p$,;A!\'*+()ar_1=val_1&quer?y_par_2=val_2', $uri->getQuery());
264 $this->assertNull($uri->getFragment());
267 #[\PHPUnit\Framework\Attributes\Depends('test_init')]
271 $this->assertEquals(
'git', $uri->getSchema());
272 $this->assertEquals(
'github.com:8080', $uri->getAuthority());
273 $this->assertEquals(
'github.com', $uri->getHost());
274 $this->assertEquals(
'8080', $uri->getPort());
275 $this->assertNull($uri->getPath());
276 $this->assertNull($uri->getQuery());
277 $this->assertEquals(
'fragment$,;A!\'*+()ar_1=val_1&', $uri->getFragment());
280 #[\PHPUnit\Framework\Attributes\Depends('test_init')]
284 $this->assertEquals(
'git', $uri->getSchema());
285 $this->assertEquals(
'git$,;hub.com:8080', $uri->getAuthority());
286 $this->assertEquals(
'git$,;hub.com', $uri->getHost());
287 $this->assertEquals(
'8080', $uri->getPort());
288 $this->assertEquals(
'someacc$,;ount/somerepo/somerepo.git', $uri->getPath());
289 $this->assertNull($uri->getQuery());
290 $this->assertEquals(
'fragA!\'*+()arment', $uri->getFragment());
293 #[\PHPUnit\Framework\Attributes\Depends('test_init')]
297 $this->assertEquals(
'git', $uri->getSchema());
298 $this->assertEquals(
'git$,;hub.com:8080', $uri->getAuthority());
299 $this->assertEquals(
'git$,;hub.com', $uri->getHost());
300 $this->assertEquals(
'8080', $uri->getPort());
301 $this->assertEquals(
'someacc$,;ount/somerepo/somerepo.git', $uri->getPath());
302 $this->assertNull($uri->getQuery());
303 $this->assertNull($uri->getFragment());
304 $this->assertEquals(
'git://git$,;hub.com:8080/someacc$,;ount/somerepo/somerepo.git', $uri->getBaseURI());
307 #[\PHPUnit\Framework\Attributes\Depends('test_init')]
311 $this->assertEquals(
'git', $uri->getSchema());
312 $this->assertEquals(
'git$,;hub.com', $uri->getAuthority());
313 $this->assertEquals(
'git$,;hub.com', $uri->getHost());
314 $this->assertNull($uri->getPort());
315 $this->assertNull($uri->getPath());
316 $this->assertNull($uri->getQuery());
317 $this->assertNull($uri->getFragment());
318 $this->assertEquals(
'git://git$,;hub.com', $uri->getBaseURI());
321 #[\PHPUnit\Framework\Attributes\Depends('test_init')]
324 $this->expectException(TypeError::class);
328 #[\PHPUnit\Framework\Attributes\Depends('test_init')]
331 $this->expectException(TypeError::class);
335 #[\PHPUnit\Framework\Attributes\Depends('test_init')]
338 $this->expectException(TypeError::class);
342 #[\PHPUnit\Framework\Attributes\Depends('test_init')]
345 $this->expectException(InvalidArgumentException::class);
349 #[\PHPUnit\Framework\Attributes\Depends('test_init')]
352 $this->expectException(InvalidArgumentException::class);
356 #[\PHPUnit\Framework\Attributes\Depends('test_init')]
359 $this->expectException(InvalidArgumentException::class);
363 #[\PHPUnit\Framework\Attributes\Depends('test_init')]
366 $this->expectException(InvalidArgumentException::class);
370 #[\PHPUnit\Framework\Attributes\Depends('test_init')]
374 $this->assertEquals(self::PATH_REALPCTENC, $uri->getPath());
375 $this->assertEquals(self::PARAMS_REALPCTENC, $uri->getParameters());
378 #[\PHPUnit\Framework\Attributes\Depends('test_init')]
381 $this->expectException(InvalidArgumentException::class);
385 #[\PHPUnit\Framework\Attributes\Depends('test_init')]
388 $this->expectException(InvalidArgumentException::class);
392 #[\PHPUnit\Framework\Attributes\Depends('test_init')]
395 $this->expectException(InvalidArgumentException::class);
399 #[\PHPUnit\Framework\Attributes\Depends('test_init')]
402 $this->expectException(InvalidArgumentException::class);
406 #[\PHPUnit\Framework\Attributes\Depends('test_init')]
409 $this->expectException(InvalidArgumentException::class);
413 #[\PHPUnit\Framework\Attributes\Depends('test_init')]
416 $this->expectException(InvalidArgumentException::class);
420 #[\PHPUnit\Framework\Attributes\Depends('test_init')]
423 $this->assertEquals(
'g+it', $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());
430 $uri = $uri->withSchema(
'http');
431 $this->assertEquals(
'http', $uri->getSchema());
432 $this->assertEquals(
'github.com:8080', $uri->getAuthority());
433 $this->assertEquals(
'github.com', $uri->getHost());
434 $this->assertEquals(
'8080', $uri->getPort());
435 $this->assertEquals(
'someaccount/somerepo/somerepo.git', $uri->getPath());
436 $this->assertEquals(
'query_par_1=val_1&query_par_2=val_2', $uri->getQuery());
437 $this->assertEquals(
'fragment', $uri->getFragment());
440 #[\PHPUnit\Framework\Attributes\Depends('test_with_schema')]
443 $this->expectException(InvalidArgumentException::class);
445 $uri->withSchema(
'');
448 #[\PHPUnit\Framework\Attributes\Depends('test_with_schema')]
451 $this->expectException(InvalidArgumentException::class);
453 $uri->withSchema(
'1aa');
456 #[\PHPUnit\Framework\Attributes\Depends('test_init')]
459 $this->assertEquals(
'g+it', $uri->getSchema());
460 $this->assertEquals(
'github.com:8080', $uri->getAuthority());
461 $this->assertEquals(
'github.com', $uri->getHost());
462 $this->assertEquals(
'8080', $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(80);
467 $this->assertEquals(
'g+it', $uri->getSchema());
468 $this->assertEquals(
'github.com:80', $uri->getAuthority());
469 $this->assertEquals(
'github.com', $uri->getHost());
470 $this->assertEquals(
'80', $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());
474 $uri = $uri->withPort();
475 $this->assertEquals(
'g+it', $uri->getSchema());
476 $this->assertEquals(
'github.com', $uri->getAuthority());
477 $this->assertEquals(
'github.com', $uri->getHost());
478 $this->assertNull($uri->getPort());
479 $this->assertEquals(
'someaccount/somerepo/somerepo.git', $uri->getPath());
480 $this->assertEquals(
'query_par_1=val_1&query_par_2=val_2', $uri->getQuery());
481 $this->assertEquals(
'fragment', $uri->getFragment());
485 #[\PHPUnit\Framework\Attributes\Depends('test_with_port')]
488 $this->expectException(TypeError::class);
490 $uri->withPort(
'a111');
493 #[\PHPUnit\Framework\Attributes\Depends('test_with_port')]
496 $this->expectException(TypeError::class);
498 $uri->withPort(
'foo');
501 #[\PHPUnit\Framework\Attributes\Depends('test_init')]
504 $this->assertEquals(
'g+it', $uri->getSchema());
505 $this->assertEquals(
'github.com:8080', $uri->getAuthority());
506 $this->assertEquals(
'github.com', $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());
511 $uri = $uri->withHost(
'ilias.de');
512 $this->assertEquals(
'g+it', $uri->getSchema());
513 $this->assertEquals(
'ilias.de:8080', $uri->getAuthority());
514 $this->assertEquals(
'ilias.de', $uri->getHost());
515 $this->assertEquals(
'8080', $uri->getPort());
516 $this->assertEquals(
'someaccount/somerepo/somerepo.git', $uri->getPath());
517 $this->assertEquals(
'query_par_1=val_1&query_par_2=val_2', $uri->getQuery());
518 $this->assertEquals(
'fragment', $uri->getFragment());
521 #[\PHPUnit\Framework\Attributes\Depends('test_with_host')]
524 $this->expectException(InvalidArgumentException::class);
526 $uri->withHost(
'-foo-.de');
531 $this->expectException(InvalidArgumentException::class);
536 #[\PHPUnit\Framework\Attributes\Depends('test_with_host')]
539 $this->expectException(InvalidArgumentException::class);
541 $uri->withHost(
'ilias.de"><script');
544 #[\PHPUnit\Framework\Attributes\Depends('test_init')]
547 $this->assertEquals(
'g+it', $uri->getSchema());
548 $this->assertEquals(
'github.com:8080', $uri->getAuthority());
549 $this->assertEquals(
'github.com', $uri->getHost());
550 $this->assertEquals(
'8080', $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(
'www1.ilias.de');
555 $this->assertEquals(
'g+it', $uri->getSchema());
556 $this->assertEquals(
'www1.ilias.de', $uri->getAuthority());
557 $this->assertEquals(
'www1.ilias.de', $uri->getHost());
558 $this->assertNull($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(
'ilias.de:80');
563 $this->assertEquals(
'g+it', $uri->getSchema());
564 $this->assertEquals(
'ilias.de:80', $uri->getAuthority());
565 $this->assertEquals(
'ilias.de', $uri->getHost());
566 $this->assertEquals(
'80', $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:1');
571 $this->assertEquals(
'g+it', $uri->getSchema());
572 $this->assertEquals(
'a:1', $uri->getAuthority());
573 $this->assertEquals(
'a', $uri->getHost());
574 $this->assertEquals(1, $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(
'a');
579 $this->assertEquals(
'g+it', $uri->getSchema());
580 $this->assertEquals(
'a', $uri->getAuthority());
581 $this->assertEquals(
'a', $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');
587 $this->assertEquals(
'g+it', $uri->getSchema());
588 $this->assertEquals(
'1.2.3.4', $uri->getAuthority());
589 $this->assertEquals(
'1.2.3.4', $uri->getHost());
590 $this->assertNull($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(
'1.2.3.4:5');
595 $this->assertEquals(
'g+it', $uri->getSchema());
596 $this->assertEquals(
'1.2.3.4:5', $uri->getAuthority());
597 $this->assertEquals(
'1.2.3.4', $uri->getHost());
598 $this->assertEquals(5, $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');
603 $this->assertEquals(
'g+it', $uri->getSchema());
604 $this->assertEquals(
'localhost1', $uri->getAuthority());
605 $this->assertEquals(
'localhost1', $uri->getHost());
606 $this->assertNull($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());
610 $uri = $uri->withAuthority(
'localhost1:10');
611 $this->assertEquals(
'g+it', $uri->getSchema());
612 $this->assertEquals(
'localhost1:10', $uri->getAuthority());
613 $this->assertEquals(
'localhost1', $uri->getHost());
614 $this->assertEquals(10, $uri->getPort());
615 $this->assertEquals(
'someaccount/somerepo/somerepo.git', $uri->getPath());
616 $this->assertEquals(
'query_par_1=val_1&query_par_2=val_2', $uri->getQuery());
617 $this->assertEquals(
'fragment', $uri->getFragment());
620 #[\PHPUnit\Framework\Attributes\Depends('test_with_authority')]
623 $this->expectException(InvalidArgumentException::class);
625 $uri->withAuthority(
'-foo-.de');
628 #[\PHPUnit\Framework\Attributes\Depends('test_with_authority')]
631 $this->expectException(InvalidArgumentException::class);
633 $uri->withAuthority(
'-bar-.de:6060');
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: ');
653 #[\PHPUnit\Framework\Attributes\Depends('test_with_authority')]
656 $this->expectException(InvalidArgumentException::class);
658 $uri->withHost(
'ilias.de:aaa');
661 #[\PHPUnit\Framework\Attributes\Depends('test_with_authority')]
664 $this->expectException(InvalidArgumentException::class);
666 $uri->withAuthority(
'foo.de&<script>');
670 #[\PHPUnit\Framework\Attributes\Depends('test_with_authority')]
673 $this->expectException(InvalidArgumentException::class);
675 $uri->withAuthority(
'foo.de"><script>alert');
679 #[\PHPUnit\Framework\Attributes\Depends('test_with_authority')]
682 $this->expectException(InvalidArgumentException::class);
684 $uri->withAuthority(
' :80');
687 #[\PHPUnit\Framework\Attributes\Depends('test_init')]
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(
'someaccount/somerepo/somerepo.git', $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(
'a/b');
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->assertEquals(
'a/b', $uri->getPath());
703 $this->assertEquals(
'query_par_1=val_1&query_par_2=val_2', $uri->getQuery());
704 $this->assertEquals(
'fragment', $uri->getFragment());
705 $uri = $uri->withPath();
706 $this->assertEquals(
'g+it', $uri->getSchema());
707 $this->assertEquals(
'github.com:8080', $uri->getAuthority());
708 $this->assertEquals(
'github.com', $uri->getHost());
709 $this->assertEquals(
'8080', $uri->getPort());
710 $this->assertNull($uri->getPath());
711 $this->assertEquals(
'query_par_1=val_1&query_par_2=val_2', $uri->getQuery());
712 $this->assertEquals(
'fragment', $uri->getFragment());
715 #[\PHPUnit\Framework\Attributes\Depends('test_with_path')]
718 $this->expectException(InvalidArgumentException::class);
720 $uri->withPath(
'/<script>/a');
723 #[\PHPUnit\Framework\Attributes\Depends('test_with_path')]
726 $this->expectException(InvalidArgumentException::class);
728 $uri->withPath(
'//a/b');
731 #[\PHPUnit\Framework\Attributes\Depends('test_with_path')]
734 $this->expectException(InvalidArgumentException::class);
736 $uri->withPath(
':a/b');
739 #[\PHPUnit\Framework\Attributes\Depends('test_init')]
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_1=val_1&query_par_2=val_2', $uri->getQuery());
748 $this->assertEquals(
'fragment', $uri->getFragment());
749 $uri = $uri->withQuery(
'query_par_a1=val_a1');
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->assertEquals(
'query_par_a1=val_a1', $uri->getQuery());
756 $this->assertEquals(
'fragment', $uri->getFragment());
757 $uri = $uri->withQuery();
758 $this->assertEquals(
'g+it', $uri->getSchema());
759 $this->assertEquals(
'github.com:8080', $uri->getAuthority());
760 $this->assertEquals(
'github.com', $uri->getHost());
761 $this->assertEquals(
'8080', $uri->getPort());
762 $this->assertEquals(
'someaccount/somerepo/somerepo.git', $uri->getPath());
763 $this->assertNull($uri->getQuery());
764 $this->assertEquals(
'fragment', $uri->getFragment());
767 #[\PHPUnit\Framework\Attributes\Depends('test_with_query')]
770 $this->expectException(InvalidArgumentException::class);
772 $uri->withQuery(
'<script>a');
775 #[\PHPUnit\Framework\Attributes\Depends('test_with_query')]
778 $this->expectException(InvalidArgumentException::class);
780 $uri->withQuery(
'aa[]');
783 #[\PHPUnit\Framework\Attributes\Depends('test_init')]
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(
'fragment', $uri->getFragment());
793 $uri = $uri->withFragment(
'someFragment');
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->assertEquals(
'someFragment', $uri->getFragment());
801 $uri = $uri->withFragment();
802 $this->assertEquals(
'g+it', $uri->getSchema());
803 $this->assertEquals(
'github.com:8080', $uri->getAuthority());
804 $this->assertEquals(
'github.com', $uri->getHost());
805 $this->assertEquals(
'8080', $uri->getPort());
806 $this->assertEquals(
'someaccount/somerepo/somerepo.git', $uri->getPath());
807 $this->assertEquals(
'query_par_1=val_1&query_par_2=val_2', $uri->getQuery());
808 $this->assertNull($uri->getFragment());
811 #[\PHPUnit\Framework\Attributes\Depends('test_with_fragment')]
814 $this->expectException(InvalidArgumentException::class);
816 $uri->withFragment(
'aaa[]');
819 #[\PHPUnit\Framework\Attributes\Depends('test_with_fragment')]
822 $this->expectException(InvalidArgumentException::class);
824 $uri->withFragment(
'script>');
838 $url = self::URI_BASE .
'?' . http_build_query(self::PARAMS);
842 $uri->getParameters()
847 #[\PHPUnit\Framework\Attributes\Depends('testGetParameters')]
850 $k = array_keys(self::PARAMS)[0];
853 $uri->getParameter($k)
857 #[\PHPUnit\Framework\Attributes\Depends('testGetParameters')]
860 $params = [
'x' => 1,
'y' => 2];
861 $uri = $uri->withParameters(
$params);
864 $uri->getParameters()
869 #[\PHPUnit\Framework\Attributes\Depends('testWithParameters')]
872 $uri = $uri->withParameter(
'x', 5);
875 $uri->getParameter(
'x')
879 #[\PHPUnit\Framework\Attributes\Depends('testWithParameters')]
886 $uri = $uri->withParameter(
'z', 5);
889 $uri->getParameters()
893 #[\PHPUnit\Framework\Attributes\Depends('testGetParameters')]
896 $params = [
'x' => 1,
'y' => [10, 11, 12]];
897 $uri = $uri->withParameters(
$params);
900 $uri->getParameters()
903 'git://github.com:8080/someaccount/somerepo/somerepo.git?x=1&y%5B0%5D=10&y%5B1%5D=11&y%5B2%5D=12',
908 $uri->getParameter(
'y')
917 $uri->getParameters()
920 $this->assertNull($uri->getParameter(
'y'));
923 self::URI_NO_QUERY_2,
The scope of this class is split ilias-conform URI's into components.
test_with_schema_invalid_2()
test_wrong_char_in_schema()
const URI_HOST_ALPHADIG_START_1
test_with_host_invalid_3()
test_with_authority_invalid_2()
testWithParameters(ILIAS\Data\URI $uri)
test_authority_and_query()
const URI_HOST_ALPHADIG_START_4
test_wrong_authority_in_schema_2()
test_with_authority_invalid_4()
const URI_HOST_ALPHADIG_START_3
test_with_path_invalid_1()
test_with_authority_invalid_8()
testWithArrayParameters(ILIAS\Data\URI $uri)
test_with_port_invalid_2()
test_with_schema_invalid_1()
test_alphadigit_start_host()
const URI_AUTHORITY_AND_FRAGMENT
testSubstituteParameter(ILIAS\Data\URI $uri)
test_base_uri_idempotent($uri)
test_alphadigit_start_host_4()
test_invalid_characters_in_query()
const URI_AUTHORITY_AND_QUERY_2
const URI_WRONG_AUTHORITY_1
test_with_host_invalid_1()
test_with_query_invalid_1()
test_alphadigit_start_host_2()
const URI_COMPLETE_LOCALHOST
test_with_port_invalid_1()
testGetParameter(ILIAS\Data\URI $uri)
test_authority_path_fragment()
test_with_authority($uri)
test_with_fragment_invalid_1()
test_with_host_invalid_4()
test_with_authority_invalid_6()
test_with_authority_invalid_7()
const URI_HOST_ALPHADIG_START_5
const URI_AUTHORITY_AND_QUERY_1
const URI_HOST_ALPHADIG_START_2
test_alphadigit_start_host_5()
test_with_path_invalid_3()
test_with_fragment_invalid_2()
test_with_authority_invalid_5()
test_with_path_invalid_2()
const URI_INVALID_CHARACTERS_IN_QUERY
test_with_query_invalid_2()
test_with_authority_invalid_1()
testAppendParameter(ILIAS\Data\URI $uri)
test_authority_and_fragment()
test_wrong_authority_in_schema_1()
const URI_WRONG_AUTHORITY_2
test_with_authority_invalid_3()
const URI_AUTHORITY_PATH_FRAGMENT
static provideIPv6addresses()
test_alphadigit_start_host_3()
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.