Completed
Pull Request — master (#15)
by John
02:41
created

DateFormatterTest::testGetDateFormatDataProvider()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 26
Code Lines 16

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 26
rs 8.8571
cc 1
eloc 16
nc 1
nop 0
1
<?php
2
3
namespace Graze\CiffRenderer\Test\Field\Parser\DateParser\DateFormatter;
4
5
use Graze\CiffRenderer\Field\Parser\DateParser\DateFormatter\DateFormatterFactory;
6
use \DateTimeImmutable;
7
8
class DateFormatterTest extends \PHPUnit_Framework_TestCase
9
{
10
    /**
11
     * @param string $expected
12
     * @param string $format
13
     *
14
     * @dataProvider testGetDateFormatDataProvider
15
     */
16
    public function testFormat($expected, $format)
17
    {
18
        $dateFormatter = DateFormatterFactory::getFormatter($format);
19
20
        $date = new DateTimeImmutable('1982-01-24');
21
22
        $actual = $dateFormatter->format($date, $format);
23
24
        $this->assertSame($expected, $actual);
25
    }
26
27
    /**
28
     * @return []
0 ignored issues
show
Documentation introduced by
The doc-type [] could not be parsed: Unknown type name "" at position 0. [(view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
29
     */
30
    public function testGetDateFormatDataProvider()
31
    {
32
        return [
33
            ["24011982", "dd''MM''yyyy"],
34
            ["24 01 1982", "dd' 'MM' 'yyyy"],
35
            ["24.01.1982", "dd'.'MM'.'yyyy"],
36
            ["24,01,1982", "dd','MM','yyyy"],
37
            ["24-01-1982", "dd'-'MM'-'yyyy"],
38
            ["24\\01\\1982", "dd'\'MM'\'yyyy"],
39
            ["24:01:1982", "dd':'MM':'yyyy"],
40
            //["81", "y"],
0 ignored issues
show
Unused Code Comprehensibility introduced by
86% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
41
            //["", "cl:yy"],
0 ignored issues
show
Unused Code Comprehensibility introduced by
86% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
42
            ["24", "cl:j"],
43
            ["024", "cl:jj"],
44
            ["24", "cl:J"],
45
            ["024", "cl:JJ"],
46
            // ["dmy", "cl:yyc"],
0 ignored issues
show
Unused Code Comprehensibility introduced by
75% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
47
            // ["dmy", "cl:dddc"],
0 ignored issues
show
Unused Code Comprehensibility introduced by
75% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
48
            // ["dmy", "cl:wwc"],
0 ignored issues
show
Unused Code Comprehensibility introduced by
75% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
49
            // ["dmy", "cl:d"],
0 ignored issues
show
Unused Code Comprehensibility introduced by
75% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
50
            ["01", "MM"],
51
            ["this is constant:24/01/1982", "'this is constant:'dd'/'MM'/'yyyy"],
52
            ["24", "d"],
53
            //["dmy", "cl:x{Claricom.BarillaJulianDate}''cl:J"],
0 ignored issues
show
Unused Code Comprehensibility introduced by
86% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
54
        ];
55
    }
56
}
57