Definition at line 25 of file URLBuilderTest.php.
◆ setUp()
ILIAS\UI\URLBuilderTest::setUp |
( |
| ) |
|
|
protected |
Definition at line 29 of file URLBuilderTest.php.
31 $this->URI_COMPLETE = new \ILIAS\Data\URI(
'https://www.ilias.de/foo/bar?var1=42&var2=foo#12345');
◆ testAcquireParam()
ILIAS\UI\URLBuilderTest::testAcquireParam |
( |
| ) |
|
Definition at line 41 of file URLBuilderTest.php.
References $url, and ILIAS\UI\URLBuilder\SEPARATOR.
43 $url =
new URLBuilder($this->URI_COMPLETE);
44 $result =
$url->acquireParameter([
'test'],
'title');
45 $this->assertInstanceOf(URLBuilder::class, $result[0]);
48 (
string) $result[0]->buildURI()
50 $this->assertInstanceOf(URLBuilderToken::class, $result[1]);
52 $this->assertNotEmpty($result[1]->getToken());
const SEPARATOR
Separator for parts of a parameter's namespace.
◆ testAcquireParamWithLongNamespace()
ILIAS\UI\URLBuilderTest::testAcquireParamWithLongNamespace |
( |
| ) |
|
Definition at line 55 of file URLBuilderTest.php.
References $url, and ILIAS\UI\URLBuilder\SEPARATOR.
57 $url =
new URLBuilder($this->URI_COMPLETE);
58 $result =
$url->acquireParameter([
'test',
'object',
'metadata'],
'title');
59 $this->assertInstanceOf(URLBuilder::class, $result[0]);
65 (
string) $result[0]->buildURI()
67 $this->assertInstanceOf(URLBuilderToken::class, $result[1]);
69 'test' . URLBuilder::SEPARATOR .
70 'object' . URLBuilder::SEPARATOR .
71 'metadata' . URLBuilder::SEPARATOR .
75 $this->assertNotEmpty($result[1]->getToken());
const SEPARATOR
Separator for parts of a parameter's namespace.
◆ testAcquireParamWithSameName()
ILIAS\UI\URLBuilderTest::testAcquireParamWithSameName |
( |
| ) |
|
Definition at line 93 of file URLBuilderTest.php.
References $url, and ILIAS\UI\URLBuilder\SEPARATOR.
95 $url =
new URLBuilder($this->URI_COMPLETE);
97 $result =
$url->acquireParameter([
'test'],
'title',
'foo');
99 'https://www.ilias.de/foo/bar?var1=42&var2=foo&test' . $sep .
'title=foo#12345',
100 (
string) $result[0]->buildURI()
102 $this->assertEquals(
'test' . $sep .
'title', $result[1]->getName());
104 $result2 = $result[0]->acquireParameter([
'notatest'],
'title',
'bar');
106 'https://www.ilias.de/foo/bar?var1=42&var2=foo&test' . $sep .
'title=foo¬atest' . $sep .
'title=bar#12345',
107 (
string) $result2[0]->buildURI()
109 $this->assertEquals(
'notatest' . $sep .
'title', $result2[1]->getName());
110 $this->assertNotEquals($result[1]->getToken(), $result2[1]->getToken());
const SEPARATOR
Separator for parts of a parameter's namespace.
◆ testAcquireParamWithValue()
ILIAS\UI\URLBuilderTest::testAcquireParamWithValue |
( |
| ) |
|
Definition at line 78 of file URLBuilderTest.php.
References $url, and ILIAS\UI\URLBuilder\SEPARATOR.
80 $url =
new URLBuilder($this->URI_COMPLETE);
82 $result =
$url->acquireParameter([
'test'],
'title',
'bar');
83 $this->assertInstanceOf(URLBuilder::class, $result[0]);
85 'https://www.ilias.de/foo/bar?var1=42&var2=foo&test' . $sep .
'title=bar#12345',
86 (
string) $result[0]->buildURI()
88 $this->assertInstanceOf(URLBuilderToken::class, $result[1]);
89 $this->assertEquals(
'test' . $sep .
'title', $result[1]->getName());
90 $this->assertNotEmpty($result[1]->getToken());
const SEPARATOR
Separator for parts of a parameter's namespace.
◆ testDeleteParam()
ILIAS\UI\URLBuilderTest::testDeleteParam |
( |
| ) |
|
Definition at line 141 of file URLBuilderTest.php.
References $url, and ILIAS\UI\URLBuilder\SEPARATOR.
143 $url =
new URLBuilder($this->URI_COMPLETE);
145 $result =
$url->acquireParameter([
'test'],
'title',
'bar');
147 'https://www.ilias.de/foo/bar?var1=42&var2=foo&test' . $sep .
'title=bar#12345',
148 (
string) $result[0]->buildURI()
151 $url = $result[0]->deleteParameter($result[1]);
152 $this->assertEquals(
'https://www.ilias.de/foo/bar?var1=42&var2=foo#12345', (
string)
$url->buildURI());
const SEPARATOR
Separator for parts of a parameter's namespace.
◆ testGetUrl()
ILIAS\UI\URLBuilderTest::testGetUrl |
( |
| ) |
|
Definition at line 34 of file URLBuilderTest.php.
References $url.
36 $url =
new URLBuilder($this->URI_COMPLETE);
37 $this->assertInstanceOf(\
ILIAS\
Data\URI::class,
$url->buildURI());
38 $this->assertEquals(
'https://www.ilias.de/foo/bar?var1=42&var2=foo#12345', (
string)
$url->buildURI());
Interface Observer Contains several chained tasks and infos about them.
◆ testRemoveAndAddFragment()
ILIAS\UI\URLBuilderTest::testRemoveAndAddFragment |
( |
| ) |
|
Definition at line 163 of file URLBuilderTest.php.
References $url, and null.
165 $url =
new URLBuilder($this->URI_COMPLETE);
167 $this->assertInstanceOf(URLBuilder::class,
$url);
168 $this->assertEquals(
'https://www.ilias.de/foo/bar?var1=42&var2=foo', (
string)
$url->buildURI());
170 $this->assertInstanceOf(URLBuilder::class, $url);
171 $this->assertEquals(
'https://www.ilias.de/foo/bar?var1=42&var2=foo#12345', (
string) $url->buildURI());
172 $url = $url->withFragment(
'54321');
173 $this->assertInstanceOf(URLBuilder::class, $url);
174 $this->assertEquals(
'https://www.ilias.de/foo/bar?var1=42&var2=foo#54321', (
string) $url->buildURI());
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
◆ testRenderObject()
ILIAS\UI\URLBuilderTest::testRenderObject |
( |
| ) |
|
Definition at line 214 of file URLBuilderTest.php.
References $url, and ILIAS\UI\URLBuilder\SEPARATOR.
216 $url =
new URLBuilder($this->URI_COMPLETE);
219 $result1 =
$url->acquireParameter([
'test',
'object'],
'title',
'bar');
221 $expected_token =
'new Map([["' . $result1[1]->getName() .
'",' 222 .
'new il.UI.core.URLBuilderToken(["test","object"], "title", "' . $result1[1]->getToken() .
'")]])';
223 $expected_object =
'new il.UI.core.URLBuilder(new URL("https://www.ilias.de/foo/bar?var1=42&var2=foo&' 225 $this->assertEquals($expected_object,
$url->renderObject([$result1[1]]));
228 $result2 =
$url->acquireParameter([
'test'],
'description',
'foo');
230 $expected_object =
'new il.UI.core.URLBuilder(new URL("https://www.ilias.de/foo/bar?var1=42&var2=foo&' 233 $this->assertEquals($expected_object,
$url->renderObject([$result1[1]]));
236 $expected_token =
'new Map([["' . $result1[1]->getName() .
'",' 237 .
'new il.UI.core.URLBuilderToken(["test","object"], "title", "' . $result1[1]->getToken() .
'")],' 238 .
'["' . $result2[1]->getName() .
'",' 239 .
'new il.UI.core.URLBuilderToken(["test"], "description", "' . $result2[1]->getToken() .
'")]])';
240 $expected_object =
'new il.UI.core.URLBuilder(new URL("https://www.ilias.de/foo/bar?var1=42&var2=foo&' 243 $this->assertEquals($expected_object,
$url->renderObject([$result1[1], $result2[1]]));
const SEPARATOR
Separator for parts of a parameter's namespace.
◆ testRenderTokens()
ILIAS\UI\URLBuilderTest::testRenderTokens |
( |
| ) |
|
Definition at line 190 of file URLBuilderTest.php.
References $url.
192 $url =
new URLBuilder($this->URI_COMPLETE);
195 $result1 =
$url->acquireParameter([
'test',
'object'],
'title',
'bar');
197 $expected_token =
'new Map([["' . $result1[1]->getName() .
'",' 198 .
'new il.UI.core.URLBuilderToken(["test","object"], "title", "' . $result1[1]->getToken() .
'")]])';
199 $this->assertEquals($expected_token,
$url->renderTokens([$result1[1]]));
202 $result2 =
$url->acquireParameter([
'test'],
'description',
'foo');
204 $this->assertEquals($expected_token,
$url->renderTokens([$result1[1]]));
207 $expected_token =
'new Map([["' . $result1[1]->getName() .
'",' 208 .
'new il.UI.core.URLBuilderToken(["test","object"], "title", "' . $result1[1]->getToken() .
'")],' 209 .
'["' . $result2[1]->getName() .
'",' 210 .
'new il.UI.core.URLBuilderToken(["test"], "description", "' . $result2[1]->getToken() .
'")]])';
211 $this->assertEquals($expected_token,
$url->renderTokens([$result1[1], $result2[1]]));
◆ testUrlTooLong()
ILIAS\UI\URLBuilderTest::testUrlTooLong |
( |
| ) |
|
Definition at line 155 of file URLBuilderTest.php.
References $url, and ILIAS\UI\URLBuilder\URL_MAX_LENGTH.
157 $url =
new URLBuilder($this->URI_COMPLETE);
159 $this->expectException(\LengthException::class);
160 $output = $result[0]->buildURI();
const URL_MAX_LENGTH
A maximum length of 2048 characters should be safe to use in most browsers, even though longer URLs w...
◆ testWithUri()
ILIAS\UI\URLBuilderTest::testWithUri |
( |
| ) |
|
Definition at line 177 of file URLBuilderTest.php.
References $url, and ILIAS\UI\URLBuilder\SEPARATOR.
179 $url =
new URLBuilder($this->URI_COMPLETE);
180 $result =
$url->acquireParameter([
'test'],
'title',
'bar');
181 $url = $result[0]->withURI(
186 (
string)
$url->buildURI()
Interface Observer Contains several chained tasks and infos about them.
const SEPARATOR
Separator for parts of a parameter's namespace.
◆ testWriteParam()
ILIAS\UI\URLBuilderTest::testWriteParam |
( |
| ) |
|
Definition at line 113 of file URLBuilderTest.php.
References $url, and ILIAS\UI\URLBuilder\SEPARATOR.
115 $url =
new URLBuilder($this->URI_COMPLETE);
117 $result =
$url->acquireParameter([
'test'],
'title',
'bar');
119 'https://www.ilias.de/foo/bar?var1=42&var2=foo&test' . $sep .
'title=bar#12345',
120 (
string) $result[0]->buildURI()
123 $url = $result[0]->withParameter($result[1],
'foobar');
124 $this->assertInstanceOf(URLBuilder::class,
$url);
126 'https://www.ilias.de/foo/bar?var1=42&var2=foo&test' . $sep .
'title=foobar#12345',
127 (
string)
$url->buildURI()
130 $url = $result[0]->withParameter($result[1], [
'foo',
'bar']);
131 $this->assertInstanceOf(URLBuilder::class, $url);
133 'https://www.ilias.de/foo/bar?var1=42&var2=foo' 134 .
'&test' . $sep . urlencode(
'title[]') .
'=foo' 135 .
'&test' . $sep . urlencode(
'title[]') .
'=bar' 137 (
string) $url->buildURI()
const SEPARATOR
Separator for parts of a parameter's namespace.
◆ $URI_COMPLETE
readonly ILIAS Data URI ILIAS\UI\URLBuilderTest::$URI_COMPLETE |
|
private |
The documentation for this class was generated from the following file: