Completed
Pull Request — master (#144)
by Markus
02:39 queued 01:41
created

testComponentWithPropertiesToString()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 19

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 19
c 0
b 0
f 0
rs 9.6333
nc 1
cc 1
nop 0
1
<?php
2
3
namespace Eluceo\iCal\Test\Unit\Presentation;
4
5
use Eluceo\iCal\Presentation\Component;
6
use Eluceo\iCal\Presentation\Component\Property\Value\StringValue;
7
use Eluceo\iCal\Presentation\Component\Property;
8
use PHPUnit\Framework\TestCase;
9
10
class ComponentTest extends TestCase
11
{
12
    public function testEmptyComponentToString()
13
    {
14
        $expected = implode(Component::LINE_SEPARATOR, [
15
            'BEGIN:VEVENT',
16
            'END:VEVENT',
17
        ]);
18
19
        self::assertSame(
20
            $expected,
21
            (string)Component::create('VEVENT')
22
        );
23
    }
24
25
    public function testComponentWithPropertiesToString()
26
    {
27
        $properties = [
28
            Property::create('TEST', StringValue::fromString('value')),
29
            Property::create('TEST2', StringValue::fromString('value2')),
30
        ];
31
32
        $expected = implode(Component::LINE_SEPARATOR, [
33
            'BEGIN:VEVENT',
34
            'TEST:value',
35
            'TEST2:value2',
36
            'END:VEVENT',
37
        ]);
38
39
        self::assertSame(
40
            $expected,
41
            (string)Component::create('VEVENT', $properties)
42
        );
43
    }
44
}
45