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

PropertyTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testPropertyToString() 0 4 1
A provideTestData() 0 28 1
1
<?php
2
3
namespace Eluceo\iCal\Test\Unit\Presentation\Component;
4
5
use Eluceo\iCal\Presentation\Component\Property;
6
use Eluceo\iCal\Presentation\Component\Property\Value;
7
use Eluceo\iCal\Presentation\Component\Property\Parameter;
8
use Eluceo\iCal\Presentation\Component\Property\Value\StringValue;
9
use PHPUnit\Framework\TestCase;
10
11
class PropertyTest extends TestCase
12
{
13
    /**
14
     * @dataProvider provideTestData
15
     */
16
    public function testPropertyToString(string $name, Value $value, array $parameters, string $expected)
17
    {
18
        self::assertSame($expected, (string)Property::create($name, $value, $parameters));
19
    }
20
21
    public function provideTestData()
22
    {
23
        yield 'property with simple value' => [
24
            'LOREM',
25
            StringValue::fromString('Ipsum'),
26
            [],
27
            'LOREM:Ipsum',
28
        ];
29
30
        yield 'property with parameters' => [
31
            'LOREM',
32
            StringValue::fromString('Ipsum'),
33
            [
34
                Parameter::create('TEST', StringValue::fromString('value')),
35
            ],
36
            'LOREM:TEST=value:Ipsum',
37
        ];
38
39
        yield 'property with multiple parameters' => [
40
            'LOREM',
41
            StringValue::fromString('Ipsum'),
42
            [
43
                Parameter::create('TEST', StringValue::fromString('value')),
44
                Parameter::create('TEST2', StringValue::fromString('value2')),
45
            ],
46
            'LOREM:TEST=value;TEST2=value2:Ipsum',
47
        ];
48
    }
49
}
50