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

DateFormatterTest::testGetDateFormatDataProvider()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 26
Code Lines 16

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
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
    /**
0 ignored issues
show
Coding Style Documentation introduced by
Doc comment for parameter "$expected" missing
Loading history...
Coding Style Documentation introduced by
Doc comment for parameter "$format" missing
Loading history...
11
     * @dataProvider testGetDateFormatDataProvider
12
     */
13
    public function testFormat($expected, $format)
14
    {
15
        $dateFormatter = DateFormatterFactory::getFormatter($format);
16
17
        $date = new DateTimeImmutable('1982-01-24');
18
19
        $actual = $dateFormatter->format($date, $format);
20
21
        $this->assertSame($expected, $actual);
22
    }
23
24
    public function testGetDateFormatDataProvider()
0 ignored issues
show
introduced by
Function has return keyword but no doc block
Loading history...
25
    {
26
        return [
27
            ["24011982", "dd''MM''yyyy"],
28
            ["24 01 1982", "dd' 'MM' 'yyyy"],
29
            ["24.01.1982", "dd'.'MM'.'yyyy"],
30
            ["24,01,1982", "dd','MM','yyyy"],
31
            ["24-01-1982", "dd'-'MM'-'yyyy"],
32
            ["24\\01\\1982", "dd'\'MM'\'yyyy"],
33
            ["24:01:1982", "dd':'MM':'yyyy"],
34
            //["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...
35
            //["", "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...
36
            ["24", "cl:j"],
37
            ["024", "cl:jj"],
38
            ["24", "cl:J"],
39
            ["024", "cl:JJ"],
40
            // ["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...
41
            // ["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...
42
            // ["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...
43
            // ["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...
44
            ["01", "MM"],
45
            ["this is constant:24/01/1982", "'this is constant:'dd'/'MM'/'yyyy"],
46
            ["24", "d"],
47
            //["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...
48
        ];
49
    }
50
}
51