Completed
Pull Request — master (#144)
by Markus
01:01
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
/*
4
 * This file is part of the eluceo/iCal package.
5
 *
6
 * (c) 2019 Markus Poerschke <[email protected]>
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
namespace Eluceo\iCal\Test\Unit\Presentation;
13
14
use Eluceo\iCal\Presentation\Component;
15
use Eluceo\iCal\Presentation\Component\Property;
16
use Eluceo\iCal\Presentation\Component\Property\Value\TextValue;
17
use PHPUnit\Framework\TestCase;
18
19
class ComponentTest extends TestCase
20
{
21
    public function testEmptyComponentToString()
22
    {
23
        $expected = implode(Component::LINE_SEPARATOR, [
24
            'BEGIN:VEVENT',
25
            'END:VEVENT',
26
        ]);
27
28
        self::assertSame(
29
            $expected,
30
            (string) Component::create('VEVENT')
31
        );
32
    }
33
34
    public function testComponentWithPropertiesToString()
35
    {
36
        $properties = [
37
            Property::create('TEST', TextValue::fromString('value')),
38
            Property::create('TEST2', TextValue::fromString('value2')),
39
        ];
40
41
        $expected = implode(Component::LINE_SEPARATOR, [
42
            'BEGIN:VEVENT',
43
            'TEST:value',
44
            'TEST2:value2',
45
            'END:VEVENT',
46
        ]);
47
48
        self::assertSame(
49
            $expected,
50
            (string) Component::create('VEVENT', $properties)
51
        );
52
    }
53
}
54