Completed
Push — master ( 7a3cb1...e42624 )
by Harry
9s
created

DateTimeProcessorTest::testIgnoreNonDateTimes()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
rs 9.4285
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
/**
3
 * This file is part of graze/data-file
4
 *
5
 * Copyright (c) 2016 Nature Delivered Ltd. <https://www.graze.com>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 *
10
 * @license https://github.com/graze/data-file/blob/master/LICENSE.md
11
 * @link    https://github.com/graze/data-file
12
 */
13
14
namespace Graze\DataFile\Test\Unit\Format\Processor;
15
16
use DateTime;
17
use Graze\DataFile\Format\Processor\DateTimeProcessor;
18
use Graze\DataFile\Test\TestCase;
19
20
class DateTimeProcessorTest extends TestCase
21
{
22 View Code Duplication
    public function testDateTimeFormat()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
23
    {
24
        $processor = new DateTimeProcessor();
25
26
        $date = new DateTime();
27
28
        static::assertEquals([$date->format('Y-m-d H:i:s')], $processor->process([$date]));
29
    }
30
31 View Code Duplication
    public function testCustomFormat()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
32
    {
33
        $processor = new DateTimeProcessor('Y-m-d');
34
35
        $date = new DateTime();
36
37
        static::assertEquals([$date->format('Y-m-d')], $processor->process([$date]));
38
    }
39
40
    public function testIgnoreNonDateTimes()
41
    {
42
        $processor = new DateTimeProcessor('Y-m-d');
43
44
        static::assertEquals(['stirng', 1, 2.5, false, null], $processor->process(['stirng', 1, 2.5, false, null]));
45
    }
46
47 View Code Duplication
    public function testInvoke()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
48
    {
49
        $processor = new DateTimeProcessor();
50
51
        $date = new DateTime();
52
53
        static::assertEquals([$date->format('Y-m-d H:i:s')], $processor([$date]));
54
    }
55
}
56