summaryrefslogtreecommitdiff
path: root/vendor/eluceo/ical/tests/Eluceo/iCal/PropertyTest.php
blob: b30f5a3a2097eaaf44da7949f395d1db8e6e2962 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php

namespace Eluceo\iCal;

class PropertyTest extends \PHPUnit_Framework_TestCase
{
    public function testPropertyWithSingleValue()
    {
        $property = new Property('DTSTAMP', '20131020T153112');
        $this->assertEquals(
            'DTSTAMP:20131020T153112',
            $property->toLine()
        );
    }

    public function testPropertyWithValueAndParams()
    {
        $property = new Property('DTSTAMP', '20131020T153112', array('TZID' => 'Europe/Berlin'));
        $this->assertEquals(
            'DTSTAMP;TZID=Europe/Berlin:20131020T153112',
            $property->toLine()
        );
    }

    public function testPropertyWithEscapedSingleValue()
    {
        $property = new Property('SOMEPROP', 'Escape me!"');
        $this->assertEquals(
            'SOMEPROP:Escape me!\\"',
            $property->toLine()
        );
    }

    public function testPropertyWithEscapedValues()
    {
        $property = new Property('SOMEPROP', 'Escape me!"', array('TEST' => 'Lorem "test" ipsum'));
        $this->assertEquals(
            'SOMEPROP;TEST="Lorem \\"test\\" ipsum":Escape me!\\"',
            $property->toLine()
        );
    }
}