ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Sabre\VObject\ParameterTest Class Reference
+ Inheritance diagram for Sabre\VObject\ParameterTest:
+ Collaboration diagram for Sabre\VObject\ParameterTest:

Public Member Functions

 testSetup ()
 
 testSetupNameLess ()
 
 testModify ()
 
 testCastToString ()
 
 testCastNullToString ()
 
 testSerialize ()
 
 testSerializeEmpty ()
 
 testSerializeComplex ()
 
 testSerializePlusSign ()
 iCal 7.0 (OSX 10.9) has major issues with the EMAIL property, when the value contains a plus sign, and it's not quoted. More...
 
 testIterate ()
 
 testSerializeColon ()
 
 testSerializeSemiColon ()
 

Detailed Description

Definition at line 7 of file ParameterTest.php.

Member Function Documentation

◆ testCastNullToString()

Sabre\VObject\ParameterTest::testCastNullToString ( )

Definition at line 59 of file ParameterTest.php.

59  {
60 
61  $cal = new Component\VCalendar();
62  $param = new Parameter($cal, 'name', null);
63  $this->assertEquals('', $param->__toString());
64  $this->assertEquals('', (string)$param);
65 
66  }

◆ testCastToString()

Sabre\VObject\ParameterTest::testCastToString ( )

Definition at line 50 of file ParameterTest.php.

50  {
51 
52  $cal = new Component\VCalendar();
53  $param = new Parameter($cal, 'name', 'value');
54  $this->assertEquals('value', $param->__toString());
55  $this->assertEquals('value', (string)$param);
56 
57  }

◆ testIterate()

Sabre\VObject\ParameterTest::testIterate ( )

Definition at line 106 of file ParameterTest.php.

References $result.

106  {
107 
108  $cal = new Component\VCalendar();
109 
110  $param = new Parameter($cal, 'name', [1, 2, 3, 4]);
111  $result = [];
112 
113  foreach ($param as $value) {
114  $result[] = $value;
115  }
116 
117  $this->assertEquals([1, 2, 3, 4], $result);
118 
119  }
$result

◆ testModify()

Sabre\VObject\ParameterTest::testModify ( )

Definition at line 30 of file ParameterTest.php.

30  {
31 
32  $cal = new Component\VCalendar();
33 
34  $param = new Parameter($cal, 'name', null);
35  $param->addValue(1);
36  $this->assertEquals([1], $param->getParts());
37 
38  $param->setParts([1, 2]);
39  $this->assertEquals([1, 2], $param->getParts());
40 
41  $param->addValue(3);
42  $this->assertEquals([1, 2, 3], $param->getParts());
43 
44  $param->setValue(4);
45  $param->addValue(5);
46  $this->assertEquals([4, 5], $param->getParts());
47 
48  }

◆ testSerialize()

Sabre\VObject\ParameterTest::testSerialize ( )

Definition at line 68 of file ParameterTest.php.

68  {
69 
70  $cal = new Component\VCalendar();
71  $param = new Parameter($cal, 'name', 'value');
72  $this->assertEquals('NAME=value', $param->serialize());
73 
74  }

◆ testSerializeColon()

Sabre\VObject\ParameterTest::testSerializeColon ( )

Definition at line 121 of file ParameterTest.php.

121  {
122 
123  $cal = new Component\VCalendar();
124  $param = new Parameter($cal, 'name', 'va:lue');
125  $this->assertEquals('NAME="va:lue"', $param->serialize());
126 
127  }

◆ testSerializeComplex()

Sabre\VObject\ParameterTest::testSerializeComplex ( )

Definition at line 84 of file ParameterTest.php.

84  {
85 
86  $cal = new Component\VCalendar();
87  $param = new Parameter($cal, 'name', ["val1", "val2;", "val3^", "val4\n", "val5\""]);
88  $this->assertEquals('NAME=val1,"val2;","val3^^","val4^n","val5^\'"', $param->serialize());
89 
90  }

◆ testSerializeEmpty()

Sabre\VObject\ParameterTest::testSerializeEmpty ( )

Definition at line 76 of file ParameterTest.php.

76  {
77 
78  $cal = new Component\VCalendar();
79  $param = new Parameter($cal, 'name', null);
80  $this->assertEquals('NAME=', $param->serialize());
81 
82  }

◆ testSerializePlusSign()

Sabre\VObject\ParameterTest::testSerializePlusSign ( )

iCal 7.0 (OSX 10.9) has major issues with the EMAIL property, when the value contains a plus sign, and it's not quoted.

So we specifically added support for that.

Definition at line 98 of file ParameterTest.php.

98  {
99 
100  $cal = new Component\VCalendar();
101  $param = new Parameter($cal, 'EMAIL', "user+something@example.org");
102  $this->assertEquals('EMAIL="user+something@example.org"', $param->serialize());
103 
104  }

◆ testSerializeSemiColon()

Sabre\VObject\ParameterTest::testSerializeSemiColon ( )

Definition at line 129 of file ParameterTest.php.

129  {
130 
131  $cal = new Component\VCalendar();
132  $param = new Parameter($cal, 'name', 'va;lue');
133  $this->assertEquals('NAME="va;lue"', $param->serialize());
134 
135  }

◆ testSetup()

Sabre\VObject\ParameterTest::testSetup ( )

Definition at line 9 of file ParameterTest.php.

9  {
10 
11  $cal = new Component\VCalendar();
12 
13  $param = new Parameter($cal, 'name', 'value');
14  $this->assertEquals('NAME', $param->name);
15  $this->assertEquals('value', $param->getValue());
16 
17  }

◆ testSetupNameLess()

Sabre\VObject\ParameterTest::testSetupNameLess ( )

Definition at line 19 of file ParameterTest.php.

19  {
20 
21  $card = new Component\VCard();
22 
23  $param = new Parameter($card, null, 'URL');
24  $this->assertEquals('VALUE', $param->name);
25  $this->assertEquals('URL', $param->getValue());
26  $this->assertTrue($param->noName);
27 
28  }

The documentation for this class was generated from the following file: