ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
StringTransformationTest.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
26use PHPUnit\Framework\TestCase;
27
28class StringTransformationTest extends TestCase
29{
31
32 protected function setUp(): void
33 {
34 $this->transformation = new StringTransformation();
35 }
36
37 public function testSimpleUri(): void
38 {
39 $uri = new URI('http://ilias.de');
40 $transformedValue = $this->transformation->transform($uri);
41
42 $this->assertEquals('http://ilias.de', $transformedValue);
43 }
44
45 public function testUriWithPath(): void
46 {
47 $uri = new URI('http://ilias.de/with/path');
48 $transformedValue = $this->transformation->transform($uri);
49
50 $this->assertEquals('http://ilias.de/with/path', $transformedValue);
51 }
52
53 public function testUriWithFragment(): void
54 {
55 $uri = new URI('http://ilias.de/test.php#title');
56 $transformedValue = $this->transformation->transform($uri);
57
58 $this->assertEquals('http://ilias.de/test.php#title', $transformedValue);
59 }
60
61 public function testSimpleUriWithQueryParameter(): void
62 {
63 $uri = new URI('http://ilias.de?test=something&further=1');
64 $transformedValue = $this->transformation->transform($uri);
65
66 $this->assertEquals('http://ilias.de?test=something&further=1', $transformedValue);
67 }
68
69 public function testUriWithQueryPathAndParameter(): void
70 {
71 $uri = new URI('http://ilias.de/with/path?test=something&further=1');
72 $transformedValue = $this->transformation->transform($uri);
73
74 $this->assertEquals('http://ilias.de/with/path?test=something&further=1', $transformedValue);
75 }
76
77 public function testTransformNotURIObjectFails(): void
78 {
79 $this->expectException(ConstraintViolationException::class);
80 $transformedValue = $this->transformation->transform('http://ilias.de');
81
82 $this->assertEquals('http://ilias.de', $transformedValue);
83 }
84}
The scope of this class is split ilias-conform URI's into components.
Definition: URI.php:35