DateTimeTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 3
dl 0
loc 28
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A flagDataProvider() 0 4 1
A testFormat() 0 5 1
A testEnglishDateTimeObject() 0 6 1
1
<?php
2
3
/*
4
 * This file is part of the EasyBanglaDate package.
5
 *
6
 * Copyright (c) 2015 Roni Saha
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
13
namespace EasyBanglaDateTests\Types;
14
15
use EasyBanglaDateTests\Utils\CsvFileIterator;
16
use EasyBanglaDate\Types\DateTime;
17
use PHPUnit\Framework\TestCase;
18
19
class DateTimeTest extends TestCase
20
{
21
22
    public function flagDataProvider()
23
    {
24
        return new CsvFileIterator(__DIR__ . '/../Resources/en_flag_data.csv');
25
    }
26
27
    /**
28
     * @dataProvider flagDataProvider
29
     * @param $time
30
     * @param $flag
31
     * @param $expected
32
     */
33
    public function testFormat($time, $flag, $expected)
34
    {
35
        $object = new DateTime($time, new \DateTimeZone('Asia/Dhaka'));
36
        $this->assertEquals($expected, $object->format($flag));
37
    }
38
39
    public function testEnglishDateTimeObject()
40
    {
41
        $object = new DateTime("2015-01-01 08:00:00", new \DateTimeZone('Asia/Dhaka'));
42
43
        $this->assertEquals("01-01-2015 08:00:00", $object->enFormat('d-m-Y H:i:s'));
44
    }
45
46
}
47