ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
StringTransformationTest.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2019 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
9 
10 require_once('./libs/composer/vendor/autoload.php');
11 
12 use ILIAS\Data\URI;
16 
18 {
22  private $transformation;
23 
24  public function setUp() : void
25  {
26  $this->transformation = new StringTransformation();
27  }
28 
29  public function testSimpleUri()
30  {
31  $uri = new URI('http://ilias.de');
32  $transformedValue = $this->transformation->transform($uri);
33 
34  $this->assertEquals('http://ilias.de', $transformedValue);
35  }
36 
37  public function testUriWithPath()
38  {
39  $uri = new URI('http://ilias.de/with/path');
40  $transformedValue = $this->transformation->transform($uri);
41 
42  $this->assertEquals('http://ilias.de/with/path', $transformedValue);
43  }
44 
45  public function testUriWithFragment()
46  {
47  $uri = new URI('http://ilias.de/test.php#title');
48  $transformedValue = $this->transformation->transform($uri);
49 
50  $this->assertEquals('http://ilias.de/test.php#title', $transformedValue);
51  }
52 
54  {
55  $uri = new URI('http://ilias.de?test=something&further=1');
56  $transformedValue = $this->transformation->transform($uri);
57 
58  $this->assertEquals('http://ilias.de?test=something&further=1', $transformedValue);
59  }
60 
62  {
63  $uri = new URI('http://ilias.de/with/path?test=something&further=1');
64  $transformedValue = $this->transformation->transform($uri);
65 
66  $this->assertEquals('http://ilias.de/with/path?test=something&further=1', $transformedValue);
67  }
68 
70  {
71  $this->expectException(ConstraintViolationException::class);
72  $transformedValue = $this->transformation->transform('http://ilias.de');
73 
74  $this->assertEquals('http://ilias.de', $transformedValue);
75  }
76 }
The scope of this class is split ilias-conform URI&#39;s into components.
Definition: URI.php:17