-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathEdifactDateTest.php
executable file
·64 lines (56 loc) · 1.33 KB
/
EdifactDateTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
namespace GeneratorTest;
use EDI\Generator\EdifactDate;
use PHPUnit\Framework\TestCase;
/**
* Class EdifactDateTest
* @package GeneratorTest
*/
class EdifactDateTest extends TestCase
{
/**
* date format test
* @throws \EDI\Generator\EdifactException
*/
public function testDateFormat()
{
$this->assertEquals(
'20180123',
EdifactDate::get('2018-01-23')
);
}
/**
* date format test
* @throws \EDI\Generator\EdifactException
*/
public function testDateTimeFormat()
{
$this->assertEquals(
'201801231000',
EdifactDate::get('2018-01-23 10:00:00', EdifactDate::DATETIME)
);
}
/**
*
*/
public function testParseFormat()
{
$dateTime = (new \DateTime())
->setDate(2018, 1, 23)
->setTime(10, 0, 0);
$this->assertEquals(
$dateTime,
EdifactDate::parseFormat('2018-01-23 10:00:00', EdifactDate::DATETIME)
);
}
public function testParseTimeFormat()
{
$dateTime = (new \DateTime())
->setDate(2018, 1, 23)
->setTime(10, 0, 0);
$this->assertEquals(
$dateTime,
EdifactDate::parseFormat('2018-01-23 10:00', EdifactDate::DATETIME)
);
}
}