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

ComponentTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 35
c 0
b 0
f 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testEmptyComponentToString() 0 12 1
A testComponentWithPropertiesToString() 0 19 1
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