ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
LocalHrefTest.php
Go to the documentation of this file.
1<?php
2
4
5use Sabre\DAV;
8
9class LocalHrefTest extends XmlTest {
10
11 function testConstruct() {
12
13 $href = new LocalHref('path');
14 $this->assertEquals('path', $href->getHref());
15
16 }
17
18 function testSerialize() {
19
20 $href = new LocalHref('path');
21 $this->assertEquals('path', $href->getHref());
22
23 $this->contextUri = '/bla/';
24
25 $xml = $this->write(['{DAV:}anything' => $href]);
26
27 $this->assertXmlStringEqualsXmlString(
28'<?xml version="1.0"?>
29<d:anything xmlns:d="DAV:"><d:href>/bla/path</d:href></d:anything>
30', $xml);
31
32 }
33 function testSerializeSpace() {
34
35 $href = new LocalHref('path alsopath');
36 $this->assertEquals('path%20alsopath', $href->getHref());
37
38 $this->contextUri = '/bla/';
39
40 $xml = $this->write(['{DAV:}anything' => $href]);
41
42 $this->assertXmlStringEqualsXmlString(
43'<?xml version="1.0"?>
44<d:anything xmlns:d="DAV:"><d:href>/bla/path%20alsopath</d:href></d:anything>
45', $xml);
46
47 }
48 function testToHtml() {
49
50 $href = new LocalHref([
51 '/foo/bar',
52 'foo/bar',
53 'http://example.org/bar'
54 ]);
55
57 '/base/',
58 []
59 );
60
61 $expected =
62 '<a href="/foo/bar">/foo/bar</a><br />' .
63 '<a href="/base/foo/bar">/base/foo/bar</a><br />' .
64 '<a href="http://example.org/bar">http://example.org/bar</a>';
65 $this->assertEquals($expected, $href->toHtml($html));
66
67 }
68
69}
An exception for terminatinating execution or to throw for unit testing.
This class provides a few utility functions for easily generating HTML for the browser plugin.
$html
Definition: example_001.php:87