Test Setup Failed
Push — master ( 2fa67e...9da392 )
by Alexander
06:28
created

ParserTest::dpParseValueByContent()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 18

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 18
rs 9.6666
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
use CyberLine\SystemdState\Parser;
4
5
class ParserTest extends \PHPUnit\Framework\TestCase
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
6
{
7
    /**
8
     * Dataprovider for Parser
9
     * @return array
10
     */
11
    public function dpParseValueByContent()
12
    {
13
        return [
14
            [['test', 'yes'], true],
15
            [['test', 'no'], false],
16
            [['test', '0'], 0],
17
            [['test', 'test'], 'test'],
18
            [['test', '0123'], '0123'],
19
            [['test', '1234'], 1234],
20
            [['test', '18446744073709551615'], '18446744073709551615'],
21
            [['After', 'test1 test2'], ['test1', 'test2']],
22
            [
23
                ['Timestamp', 'Do 2019-02-04 12:00:00 CET'],
24
                date_create_immutable_from_format('* Y-m-d H:i:s e', 'Do 2019-02-04 12:00:00 CET')
25
            ],
26
            [['Environment', 'FOO=bar BAZ=foo'], ['FOO' => 'bar', 'BAZ' => 'foo']],
27
        ];
28
    }
29
30
    /**
31
     * @dataProvider dpParseValueByContent
32
     * @param $data
33
     * @param $expected
34
     */
35
    public function testParseValueByContent($data, $expected)
36
    {
37
        $this->assertEquals($expected, Parser::parseValueByContent($data));
38
    }
39
}
40