ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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
10require_once('./libs/composer/vendor/autoload.php');
11
16
18{
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}
An exception for terminatinating execution or to throw for unit testing.
The scope of this class is split ilias-conform URI's into components.
Definition: URI.php:18